-
Notifications
You must be signed in to change notification settings - Fork 291
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
forget DHT pubkey of offline friend after DHT timeout #615
Conversation
Reviewed 1 of 1 files at r1. Comments from Reviewable |
7d828fc
to
d279d19
Compare
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks pending. Comments from Reviewable |
d279d19
to
0fce3fc
Compare
@zugz Can you please sign the CLA for this to be mergeable ? |
* Tuesday, 2017-11-21 at 15:54 +0000 - SkyzohKey <[email protected]>:
@zugz Can you please sign the CLA for this to be mergable ?
It's meant to be optional for c-toxcore, and I'd rather not sign it.
|
@zugz : Thanks for analyzing, describing and fixing (hopefully) the related bugs with your PR. This would be a milestone for TOX. |
* Tuesday, 2017-11-21 at 20:29 +0000 - toxtox <[email protected]>:
@zugz : Thanks for analyzing, describing and fixing (hopefully) the
related bugs with your PR.
Thanks for bringing #240 to my attention. Could you test to see if this
does fix it?
|
Oh, this would be a challenge for me. I guess I have to compile the c-toxcore library with TRifA or Antox but I have no cross-compile tool-chain until now. |
* Tuesday, 2017-11-21 at 22:09 +0000 - toxtox <[email protected]>:
> Could you test to see if this does fix it?
Oh, this would be a challenge for me. I guess I have to compile the
c-toxcore library with TRifA or Antox but I have no cross-compile
tool-chain until now.
Ah OK, I only asked because you mentioned having some tests for
reproducing it. I tested it in toxic, and witnessed the problem and that
this PR solved it. It'd be nice to have confirmation that it fixes it
for others' setups too, but maybe it's not vital. I'm pretty sure this
PR can't do any harm.
|
Reviewed 1 of 1 files at r1. Comments from Reviewable |
Awesome work fixing this long-standing bug, @zugz! We're lucky to have you involved. :) |
According to my tests, this fixes #240. I expect it also fixes #237.
The problem was as follows: if a friend goes offline for long enough, we stop
searching for them on the DHT, but then if they come back with the same DHT key
(as will be the case if the network connection was interrupted but their client
wasn't restarted), prior to this patch we didn't initiate a new search.
The reason that it took two disconnections for this to cause a problem is that
we keep information on their ip address and tcp relays, and attempt to reuse
after a disconnect if there's still a DHT search ongoing. So if the first
disconnect lasted for at least 122s, the DHT search was deleted, but we could
still connect back using the old details once they reconnected; but then on a
subsequent disconnect, the old details wouldn't be used and nor would a DHT
search start up, so we'd never reconnect to the friend.
This PR zeroes out the friend's DHT PK when we delete them from the DHT, so the
next dhtpk packet we get from them will trigger us to add them back to the DHT
search list.
This change is