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

Add an "Auto" client/server DHT mode #216

Closed
Stebalien opened this issue Dec 19, 2018 · 2 comments
Closed

Add an "Auto" client/server DHT mode #216

Stebalien opened this issue Dec 19, 2018 · 2 comments
Assignees

Comments

@Stebalien
Copy link
Member

Currently, the user has to specify that they either want a DHT client or a client+server. I'd like to add an option (preferably enabled by default) that only turns on server mode after:

  1. A period of stability.
  2. We receive at least one inbound connection on a non-relay transport.

The tricky part here will be transitioning from client mode to server mode. Our existing peers won't accept us as a DHT server because we will have previously rejected their attempts to negotiate the DHT protocol.

Thougths?

@anacrolix
Copy link
Contributor

I think the nomenclature client/server for DHT is misleading. Rather clients are "passive" nodes, this is how it's done in BitTorrent. The DHT implementation should always be stable. DHT nodes that have just started may not provide particularly useful responses to some queries, but that's actually okay: The nature of a DHT is that some nodes may go bad or be poorly implemented and that won't affect the health of the swarm. It's actually simpler just to not handle this case at all.

@Stebalien
Copy link
Member Author

Rather clients are "passive" nodes, this is how it's done in BitTorrent.

Well, it really query-only mode (mostly) versus full mode. The active side is actually the "client" (making requests), the "server" just responds to requests.

The nature of a DHT is that some nodes may go bad or be poorly implemented and that won't affect the health of the swarm.

That's not true at all. Given enough bad nodes, a DHT becomes unusable.

Unfortunately, this is actually a pretty big problem for us because we have a ton of nodes behind NATs. They:

  1. Make outbound connections to insert themselves into the DHT.
  2. Cannot accept inbound connections, making it hard to actually traverse the DHT.

(we can probably survive without the period of stability but it can't hurt)


This probably isn't an issue for mainline because it uses UDP so, I'm assuming, nodes behind NATs won't be pingable (so they'll be dropped from routing tables pretty quickly).

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

Successfully merging a pull request may close this issue.

4 participants