feat: close passive server when client disconnects
Since a passive server is created for an individual client, when it disconnects from the server we can assume the server is done and should close it.
This commit is contained in:
@@ -53,6 +53,7 @@ class Passive extends Connector {
|
|||||||
this.dataSocket = socket;
|
this.dataSocket = socket;
|
||||||
this.dataSocket.setEncoding(this.connection.transferType);
|
this.dataSocket.setEncoding(this.connection.transferType);
|
||||||
this.dataSocket.on('error', (err) => this.server && this.server.emit('client-error', {connection: this.connection, context: 'dataSocket', error: err}));
|
this.dataSocket.on('error', (err) => this.server && this.server.emit('client-error', {connection: this.connection, context: 'dataSocket', error: err}));
|
||||||
|
this.dataSocket.once('close', () => this.closeServer());
|
||||||
|
|
||||||
if (!this.connection.secure) {
|
if (!this.connection.secure) {
|
||||||
this.dataSocket.connected = true;
|
this.dataSocket.connected = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user