mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-12 00:17:56 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
054e818bd9 | ||
|
|
107806b304 | ||
|
|
426795395c | ||
|
|
df929876de | ||
|
|
1002105f7a | ||
|
|
8f4f82a413 | ||
|
|
e1745e20ac | ||
|
|
681f004fe9 |
@@ -63,8 +63,9 @@ Client.prototype._onConnect = function(req, res){
|
||||
this.connection = req.connection;
|
||||
|
||||
this.connection.addListener('end', function(){
|
||||
self._onClose();
|
||||
self.connection.end();
|
||||
self.connection.destroy();
|
||||
self._onClose();
|
||||
});
|
||||
|
||||
if (req){
|
||||
@@ -121,20 +122,25 @@ Client.prototype._onHeartbeat = function(h){
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype._onClose = function(){
|
||||
Client.prototype._onClose = function(skipDisconnect){
|
||||
if (this._open){
|
||||
var self = this;
|
||||
if ('_heartbeatInterval' in this) clearTimeout(this._heartbeatInterval);
|
||||
if ('_heartbeatTimeout' in this) clearTimeout(this._heartbeatTimeout);
|
||||
this._open = false;
|
||||
this._disconnectTimeout = setTimeout(function(){
|
||||
self._onDisconnect();
|
||||
}, this.options.closeTimeout);
|
||||
if (skipDisconnect !== false){
|
||||
if (this.handshaked)
|
||||
this._disconnectTimeout = setTimeout(function(){
|
||||
self._onDisconnect();
|
||||
}, this.options.closeTimeout);
|
||||
else
|
||||
this._onDisconnect();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Client.prototype._onDisconnect = function(){
|
||||
if (this._open) this._onClose();
|
||||
if (this._open) this._onClose(true);
|
||||
if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
|
||||
if (this.connected){
|
||||
this._writeQueue = [];
|
||||
|
||||
@@ -19,7 +19,7 @@ WebSocket.prototype._onConnect = function(req, socket){
|
||||
|
||||
if (this.request.headers.upgrade !== 'WebSocket' || !this._verifyOrigin(this.request.headers.origin)){
|
||||
this.listener.options.log('WebSocket connection invalid or Origin not verified');
|
||||
this.connection.destroy();
|
||||
this._onClose();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ WebSocket.prototype._handle = function(data){
|
||||
chunk = chunks[i];
|
||||
if (chunk[0] !== '\u0000'){
|
||||
this.listener.options.log('Data incorrectly framed by UA. Dropping connection');
|
||||
this.connection.end();
|
||||
this.connection.destroy();
|
||||
this._onClose();
|
||||
return false;
|
||||
}
|
||||
this._onMessage(chunk.slice(1));
|
||||
@@ -99,9 +98,8 @@ WebSocket.prototype._proveReception = function(headers){
|
||||
if (spaces === 0 || n % spaces !== 0){
|
||||
if (this.listener && this.listener.options){
|
||||
this.listener.options.log('Invalid WebSocket key: "' + k + '". Dropping connection');
|
||||
this._onClose();
|
||||
}
|
||||
this.connection.end();
|
||||
this.connection.destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ "name" : "socket.io"
|
||||
, "description" : "The cross-browser WebSocket"
|
||||
, "version" : "0.6"
|
||||
, "version" : "0.6.1"
|
||||
, "author" : "LearnBoost"
|
||||
, "licenses" :
|
||||
[ { "type" : "MIT"
|
||||
|
||||
Reference in New Issue
Block a user