socket: Also cancel ACK timeouts on reconnect

We know we'll never get them and we don't want to trigger additional
reconnects.

(imported from commit c8f932cda378cacf0242aa57bbc829d2f51de2e1)
This commit is contained in:
Zev Benjamin
2013-12-05 14:11:50 -05:00
parent 682a1c92e0
commit 3bd3991d1b

View File

@@ -236,13 +236,14 @@ Socket.prototype = {
this._heartbeat_timeout_id = null;
}
// Cancel any pending auth requests
// Cancel any pending auth requests and any timeouts for ACKs
_.each(this._requests, function (val, key) {
if (val.ack_timeout_id !== null) {
clearTimeout(val.ack_timeout_id);
val.ack_timeout_id = null;
}
if (val.type === 'auth') {
if (val.ack_timeout_id !== null) {
clearTimeout(val.ack_timeout_id);
val.ack_timeout_id = null;
}
delete that._requests[key];
}
});