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

Peer management multiple PUT request doesn't disconnect properly. #236

Closed
AdamMagaluk opened this issue Sep 22, 2015 · 1 comment
Closed

Comments

@AdamMagaluk
Copy link
Collaborator

Notice there seems to be a weird case if you perform multiple PUT request on a peer with a url to the original cloud server it creates multiple connections after first request.

Example: Hub1 -> Cloud

curl -X PUT --data url='http://cloud' http://cloud/peer-management/<connection_id_1>

At this point hub1 will disconnect from cloud and reconnect back to cloud.

To force a second disconnect:

curl -X PUT --data url='http://cloud' http://cloud/peer-management/<connection_id_2>

After this request the hub goes into a loop trying to connect to the cloud but receives a 409 conflict because it's already peered.

@AdamMagaluk
Copy link
Collaborator Author

When using the method PUT on a peer should we be creating a new peer connection? Or just updating the existing one's url?

self.server._peers.push(url);
var newPeer = {
url: url,
direction: 'initiator',
status: 'connecting'
};
self.registry.add(newPeer, function(err, newPeer) {
if (err) {
env.response.statusCode = 500;
return next(env);
}
self.server._runPeer(newPeer);
self._disconnect(peer);
env.response.statusCode = 200;
next(env);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant