Skip to content
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

Correctly update internal connection status #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/ddp-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ DDPClient.prototype._message = function(data) {

} else if (data.msg === "connected") {
self.session = data.session;
self._isConnecting = false;
self._isReconnecting = false;
self.emit("connected");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This emit triggers a call to this listener (when registered by providing a connect function):
https://github.com/oortcloud/node-ddp-client/blob/master/lib/ddp-client.js#L314-L320

In the current code, that listener function calls connect (passing self._isReconnecting as a parm) before clearing self._isReconnecting in the subsequent lines. With this change, the value of self._isReconnecting will be cleared prior to that call being made, potentially changing the behavior of a registered connect function.


// method result
Expand Down