holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.04k stars 84 forks source link

v1 tests #25

Closed davidmarkclements closed 5 years ago

davidmarkclements commented 5 years ago
mafintosh commented 5 years ago

@davidmarkclements anyway to still support a general max sockets? in most cases you don't care much if you're acting as a server or client (having the individual is cool too).

re, the lookup: false still emitting peers. that's a typo/misunderstanding. any dht operation will emit peers.

on your another side note: no a connection should not be established in this case, until the lookup peer does another lookup op against the dht after the announce

davidmarkclements commented 5 years ago

@davidmarkclements anyway to still support a general max sockets? in most cases you don't care much if you're acting as a server or client (having the individual is cool too).

so the reason I split them was that it became apparent that treating them the same could become a footgun. I need to regather my thoughts, it might make sense to have a face to face convo about this one

re, the lookup: false still emitting peers. that's a typo/misunderstanding. any dht operation will emit peers.

ok.. I think that means that the implicit ergonomics of this can lead to accidental double operations (again may be better to explain at higher res)

on your another side note: no a connection should not be established in this case, until the lookup peer does another lookup op against the dht after the announce

at a high level this feels unintuitive - although it completely makes sense in a server/client paradigm (this is a similar tension to the separating server/client connections discussion)

mafintosh commented 5 years ago

@davidmarkclements if you disable lookup and only do announce you are basically opting in to behaving as a server.

happy to discuss the maxServer/Client stuff face to face. After reading the impl I'd worry a bit that support both maxPeers and this might be complicated, and maxPeers is more important than maxServer here.

The way I initially considered implementing it was kinda like utpServer.maxConnections = tcpServer.maxConnections = Infinity and then setting both of those to 0 if connections.length >= maxPeers. If a connection drops reset them to Infinity.

davidmarkclements commented 5 years ago

this PR is dependent on guts PR: https://github.com/hyperswarm/guts/pull/9

davidmarkclements commented 5 years ago

re peer removal #26 - which is based on this branch

mafintosh commented 5 years ago

@davidmarkclements guts 1.0.0 is out here with your PR, you wanna bump it here?

mafintosh commented 5 years ago

@davidmarkclements i'm still not sure i follow the maxPeers logic. when reading the code it seems to me like the client connections will max out at 16 (default) although maxPeers is set to 24?

Maybe let's talk it through on our call

davidmarkclements commented 5 years ago

discussion result was to set max clients default to infinity - done in https://github.com/hyperswarm/network/pull/25/commits/ed858f191688f86e0f24e85f3f0dc3410cc0d610