diff --git a/xftp-web/src/agent.ts b/xftp-web/src/agent.ts index 5ccfc6cb3..d54ea41be 100644 --- a/xftp-web/src/agent.ts +++ b/xftp-web/src/agent.ts @@ -22,8 +22,7 @@ import { deleteXFTPChunk, ackXFTPChunk, XFTPAgent } from "./client.js" export {XFTPAgent, type TransportConfig, - XFTPRetriableError, XFTPPermanentError, isRetriable, categorizeError, humanReadableMessage, - ackXFTPChunk, addXFTPRecipients} from "./client.js" + XFTPRetriableError, XFTPPermanentError, isRetriable, categorizeError, humanReadableMessage} from "./client.js" import {processDownloadedFile, decryptReceivedChunk} from "./download.js" import type {XFTPServer} from "./protocol/address.js" import {formatXFTPServer, parseXFTPServer} from "./protocol/address.js" diff --git a/xftp-web/src/client.ts b/xftp-web/src/client.ts index 587189cf1..04f1f9222 100644 --- a/xftp-web/src/client.ts +++ b/xftp-web/src/client.ts @@ -181,6 +181,15 @@ export class XFTPAgent { this._connectFn = connectFn ?? connectXFTP } + closeServer(server: XFTPServer): void { + const key = formatXFTPServer(server) + const conn = this.connections.get(key) + if (conn) { + this.connections.delete(key) + conn.client.then(c => c.transport.close(), () => {}) + } + } + close(): void { for (const conn of this.connections.values()) { conn.client.then(c => c.transport.close(), () => {}) @@ -229,15 +238,6 @@ export function removeStaleConnection( } } -export function closeXFTPServerClient(agent: XFTPAgent, server: XFTPServer): void { - const key = formatXFTPServer(server) - const conn = agent.connections.get(key) - if (conn) { - agent.connections.delete(key) - conn.client.then(c => c.transport.close(), () => {}) - } -} - // -- Connect + handshake export async function connectXFTP(server: XFTPServer, config?: Partial): Promise { @@ -448,8 +448,3 @@ export async function pingXFTP(agent: XFTPAgent, server: XFTPServer): Promise