diff --git a/proxy/proxypair.js b/proxy/proxypair.js index e5f33ea..58efa1a 100644 --- a/proxy/proxypair.js +++ b/proxy/proxypair.js @@ -184,6 +184,10 @@ class ProxyPair { this.client.close(); } this.client = null; + if (this.peerConnOpen()) { + this.pc.close(); + } + this.pc = null; if (this.relayIsReady()) { this.relay.close(); } @@ -238,6 +242,10 @@ class ProxyPair { return void 0 === ws || WebSocket.CLOSED === ws.readyState; } + peerConnOpen() { + return (null !== this.pc) && ('closed' !== this.pc.connectionState); + } + } ProxyPair.prototype.MAX_BUFFER = 10 * 1024 * 1024;