socket: Cancel pending auth requests on reconnect

(imported from commit 02ea7c1592ef48e2596a0dfd4830c2307a3e7df4)
This commit is contained in:
Zev Benjamin 2013-12-05 11:31:20 -05:00
parent 002df64811
commit cd9a44f35b
1 changed files with 11 additions and 0 deletions

View File

@ -227,6 +227,17 @@ Socket.prototype = {
this._heartbeat_timeout_id = null;
}
// Cancel any pending auth requests
_.each(this._requests, function (val, key) {
if (val.type === 'auth') {
if (val.ack_timeout_id !== null) {
clearTimeout(val.ack_timeout_id);
val.ack_timeout_id = null;
}
delete that._requests[key];
}
});
this._is_open = false;
this._is_authenticated = false;
this._is_reconnecting = true;