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

Remove nodes with same ip/port #35

Closed
vdrg opened this issue Oct 7, 2017 · 8 comments
Closed

Remove nodes with same ip/port #35

vdrg opened this issue Oct 7, 2017 · 8 comments

Comments

@vdrg
Copy link
Contributor

vdrg commented Oct 7, 2017

If a node is added to the heap, shouldn't a existing node with the same ip/port be deleted? Now, when a node reconnects it gets stored again.

@bmuller
Copy link
Owner

bmuller commented Oct 7, 2017

Don't think so - see here

@vdrg
Copy link
Contributor Author

vdrg commented Oct 11, 2017

but the id is computed randomly, right? what I mean is that not only it should delete nodes with the same id, but also nodes with the same ip/port.

@bmuller
Copy link
Owner

bmuller commented Oct 11, 2017 via email

@vdrg
Copy link
Contributor Author

vdrg commented Oct 11, 2017

For example, if you start a server for bootstrapping and 2 nodes, if one of the nodes reconnects and then goes offline again, the remaining node will try to send two messages to the offline node:

Type a command(get/set):
set hello byebye
Did not received reply for msg id b'dyK00zT4pkYKRX3uZJ+pWIJ5TH0=' within 5 seconds
Did not received reply for msg id b'jQMY0ZiKXqz9UxC66BuYPOBVqWQ=' within 5 seconds
no response from 127.0.0.1:1235, removing from router
no response from 127.0.0.1:1235, removing from router
Value set.

BTW, I'm using the python3.5 branch

@bmuller
Copy link
Owner

bmuller commented Oct 11, 2017 via email

@vdrg
Copy link
Contributor Author

vdrg commented Oct 11, 2017

I think I didn't explain it well enough:

That happens when one of the nodes connects, disconnects, connects again and finally disconnects. I'm not talking about two nodes running at the same time on the same machine, what I mean is that a new node will be created and stored in the table even if it has already been stored before (which happens when the same node connects to the network multiple times, as a different id is created each time).

@bmuller
Copy link
Owner

bmuller commented Oct 11, 2017

I'm not sure why the node id would change on disconnect. If you mean in the case that someone destroys the existing Server object and then instantiates another, then I suppose this would happen - but I'm not sure that this would be a common occurrence. If there's a risk that your python process may die - then use the saveState and loadState methods on Server and your new instance will have the same node id and list of bootstrappable neighbors.

@vdrg
Copy link
Contributor Author

vdrg commented Oct 12, 2017

Perfect, I will try that. Thanks!

@vdrg vdrg closed this as completed Oct 12, 2017
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

2 participants