nictuku / dht

Kademlia/Mainline DHT node in Go.
Other
826 stars 144 forks source link

Ability to stop DoDHT() #18

Closed xsleonard closed 10 years ago

xsleonard commented 10 years ago

I am writing tests for an application that uses the DHT and I need to be able to stop a go d.DoDHT() for test isolation teardown.

nictuku commented 10 years ago

Nice feature, thanks for this.

I like your approach, though I have two concerns:

1) a nicer API would be to provide a Stop method to *DHT, instead of an exposed channel. 2) this is going to leak goroutines like pingSlowly and readFromSocket.

I will merge your PR but I'd like to make the improvements above, too. That means changing the API once more, but I think that's OK.

Would you like to send a follow-up PR? Otherwise I can do it.

xsleonard commented 10 years ago

I would prefer you do it since those details are more intimate

nictuku commented 10 years ago

Will do. But please note that you'll have to update your code once more since the API will change. Sorry in advance.

On Tue, Jan 21, 2014 at 11:43 PM, Steve Leonard notifications@github.comwrote:

I would prefer you do it since those details are more intimate

— Reply to this email directly or view it on GitHubhttps://github.com/nictuku/dht/pull/18#issuecomment-32972793 .

Yves Junqueira http://google.com/+YvesJunqueira