From 3884959577c672d4e2ef59572594fa9c8ebb7457 Mon Sep 17 00:00:00 2001 From: wackfordjf3 Date: Wed, 2 Nov 2011 12:58:59 -0700 Subject: [PATCH] Clears the timeout from reconnection attempt when there is a successful or failed reconnection. This fixes the issue of setTimeout's carrying over from previous reconnection and changing (skipping) values of self.reconnectionDelay in the newer reconnection. --- lib/socket.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/socket.js b/lib/socket.js index 0f1b1c762..c5a79a76d 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -1,4 +1,3 @@ - /** * socket.io * Copyright(c) 2011 LearnBoost @@ -464,6 +463,8 @@ self.publish('reconnect', self.transport.name, self.reconnectionAttempts); } + clearTimeout(self.reconnectionTimer); + self.removeListener('connect_failed', maybeReconnect); self.removeListener('connect', maybeReconnect);