[snowflake/master] Make sure we close peer connections in proxy

commit b9138d0c7e0de46cac8644b293a56faba49d9b43 Author: Cecylia Bocovich <cohosh@torproject.org> Date: Mon Oct 14 18:19:56 2019 -0400 Make sure we close peer connections in proxy Not closing peer connections was causing UDP sockets to remain open indefinitely (as reported in ticket #31285). --- proxy/proxypair.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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;
participants (1)
-
cohosh@torproject.org