Skip to content

Commit a460ad8

Browse files
authored
fix: Handle socket timeout to prevent connections from leaking (#407)
1 parent dbf0eab commit a460ad8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ export class Server extends EventEmitter {
203203

204204
this.connections.delete(unique);
205205
});
206+
// We have to manually destroy the socket if it timeouts.
207+
// This will prevent connections from leaking and close them properly.
208+
socket.on('timeout', () => {
209+
socket.destroy();
210+
});
206211
}
207212

208213
/**

0 commit comments

Comments
 (0)