fix(PortProxy): Optimize connection cleanup logic in PortProxy by removing unnecessary delays.
This commit is contained in:
@ -143,15 +143,11 @@ export class PortProxy {
|
||||
const cleanupOnce = async () => {
|
||||
if (!connectionRecord.connectionClosed) {
|
||||
connectionRecord.connectionClosed = true;
|
||||
await plugins.smartdelay.delayFor(0);
|
||||
if (connectionRecord.cleanupTimer) {
|
||||
clearTimeout(connectionRecord.cleanupTimer);
|
||||
}
|
||||
await plugins.smartdelay.delayFor(0);
|
||||
if (!socket.destroyed) socket.destroy();
|
||||
await plugins.smartdelay.delayFor(0);
|
||||
if (connectionRecord.outgoing && !connectionRecord.outgoing.destroyed) connectionRecord.outgoing.destroy();
|
||||
await plugins.smartdelay.delayFor(0);
|
||||
this.connectionRecords.delete(connectionRecord);
|
||||
console.log(`Connection from ${remoteIP} terminated. Active connections: ${this.connectionRecords.size}`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user