libp2p / go-libp2p-circuit

Circuit Switching for libp2p
MIT License
48 stars 16 forks source link

Tag peers with live hop streams #75

Closed vyzo closed 5 years ago

vyzo commented 5 years ago

This adds connection manager tagging for peers with live hops. Note the extra supervisory goroutine in the hop, as we need to ensure both sides are closed before removing the tag and reduce the live hop count.

Closes #65

vyzo commented 5 years ago

~Reusing the existing goroutine will linger too, and will make decrementing the stream count awkward. Plus the new goroutine has a very short stack, which is not necessarily the case when reusing the goroutine.~

But I do like the idea of the atomic counter, it's more code but totally obviates the need for the extra goroutine.

vyzo commented 5 years ago

Alright, implemented with an atomic counter.