-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
dht-ping crashes when attempting to ping a non-Bittorrent server address #41
Comments
Oh dear, this looks non-trivial. |
bencode: * Handle omitempty on non-trivial types. cmd/dht-ping: * Handle timeouts in ping transactions. dht: * Propagate failed transaction responses properly. * Msg related tests are moved into their own file. * In some places, IPs in binary form are shorted to 4 bytes if IPv4.
The first fix was bogus, see the later commit. Let me know how it goes. |
Nice fix. It seems to me that when the ping fails, What was the logic there? What is the purpose of |
I don't actually recall why it works like that, I think it kind of evolved that way. I don't like how complex the response handling is, but it seemed justified at the time. If you can think of a clearer way, I welcome it. It mainly went this path due to a need to reduce the number of goroutines. When I first wrote the DHT package, the server could easily jump to 200k goroutines, which wasn't compatible with the race detector. jitterDuration implements slightly randomized timeouts, this is common in many network protocols to reduce the chance of network storms. That is, if a bunch of timeouts all trigger at the same time, a lot of outbound packets are sent too quickly. This occurs when you write a lot of packets over something like UDP, and then set identical timeouts to resend them all. |
Attempting to ping a non-server, for example with
dht-ping google.com:80
crushes the program after the timeout:The text was updated successfully, but these errors were encountered: