-
Notifications
You must be signed in to change notification settings - Fork 169
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
"implied_port" is improperly handled #29
Comments
Aha, thank you https://github.com/clostra/dcdn/blob/master/client.c#L222 |
Fixed in 7166f21. Thanks. |
I've also added explicit support for |
Tested 5853ed1 with transmission. No problems. Thousands of
|
OK, it seems to be about 25 per thousand |
I think it might make sense to log the inverse. Does this make sense?
|
I think it might make sense to log the inverse. Does this make sense?
No, I don't think so. IMHO, port and implied_port should be exclusive.
|
OK, recommend removing the debug statement. It's not about debugging the DHT. |
0.24 implementation and DHT pollution. https://github.com/cfpp2p/dht-trs-trs/tree/port-logging logged: Forty-two percent of 118,152 messages contained optional Of those, 98 percent contain both With 0.24 Of course this is assuming that |
Bencoding has lexigraphically sorted keys, so |
Bencoding has lexigraphically sorted keys, so implied_port should come first.
And therefore implied_port was taking priority, since memmem stops at the
first match. Exactly the wrong behaviour.
I'm feeling pretty bad about this bug. I'm seriously considering
switching to a proper bencoding parser, but I want dht.c to remain
a single-file implementation with minimal dependencies.
|
Sounds like a fun challenge. How many lines would be acceptable? |
Sounds like a fun challenge. How many lines would be acceptable?
If I give you a figure, will you cheat by using 500-character lines?
Seriously, though, size is not really a concern, simplicity is, as well as
the fact that it remains a single file with all privates hidden behind
static.
Note by the way that you shouldn't be doing any memory allocations (except
strings) or recursion -- you just need to walk the two (if memory serves)
dictionaries used by the DHT, and fill in a fixed-format struct.
|
How about net 8 lines? #31 |
If a message includes the "implied_port" argument, the message parser finds the "port" portion of the "implied_port" argument key and uses its value as the port, which is always 0 or 1.
See BEP 5 for proper handling of the "implied_port" argument.
The text was updated successfully, but these errors were encountered: