refactor: refine code

This commit is contained in:
avwo
2021-09-01 11:58:28 +08:00
parent 5830ea26c1
commit c8a4f514ba
8 changed files with 20 additions and 18 deletions
+4 -5
View File
@@ -171,10 +171,8 @@ function getClient(req, socket, name, callback) {
return socket;
}
}, function() {
if (closed == null) {
closed = false;
callback(client);
}
callback && callback(client);
callback = null;
});
clients[name] = client;
client._updateTime = Date.now();
@@ -185,7 +183,8 @@ function getClient(req, socket, name, callback) {
delete clients[name];
client.close();
socket.destroy();
callback();
callback && callback(client);
callback = null;
}
};
socket.on('error', handleClose);