-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix reconnect loop #115
Fix reconnect loop #115
Conversation
645e4ff
to
fe0d2fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and makes sense.
I wonder if we should just unbind all event listeners while we're here, like we do in our destory()
, just to be on the safe side?
The 'close' listener is called when the socket is destroyed, which initiates another reconnect attempt. This reconnect attempt disconnects the new connection created by this control flow after the `retryDelay`. To avoid an endless reconnect loop, we need to remove the 'close' listener here before destroying the socket. Fix matrix-org#96
Signed-off-by: jkhsjdhjs <leon.moeller@yahoo.de>
16ca6f2
to
5377bd5
Compare
I guess it can't hurt and it also makes the code a bit prettier, as we can move the unbinding of the listeners to a separate function. Did so in 5377bd5 |
Perfect. Sorry for having this sit for long – thanks for the ping! |
Github checks look stuck, but it's all good for me locally. |
The
close
listener is called when the socket is destroyed, which initiates another reconnect attempt. This reconnect attempt disconnects the new connection created by this control flow after theretryDelay
. To avoid an endless reconnect loop, we need to remove theclose
listener here before destroying the socket.Fix #96