mirror of
https://github.com/avwo/whistle.git
synced 2026-10-21 00:37:53 +08:00
refactor: refine code
This commit is contained in:
+4
-5
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user