-
Notifications
You must be signed in to change notification settings - Fork 911
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
Improve connectd to try non-tor connection first and filter duplicates #4731
Improve connectd to try non-tor connection first and filter duplicates #4731
Conversation
@rustyrussell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments: would you like to also add code to send pings to Tor connections which we initiated, every rand(30) + 30 seconds? Seems it would help with connectivity...
This does two things: - It moves non-tor addresses upfront so it prefers normal connection which are less laggy and more reliable. - It prevents connectd from trying the same wire_addr twice when the addr_hint was given and gossip also added the same address. Changelog-Changed: connectd: try non-TOR connections first Changelog-Fixed: connectd: do not try address hint twice
This renames all occurences of use_proxy_always to always_use_proxy to keep it inline with config values. This was a bit confusing. Only significant change is that the payload in the plugins init requests also contained the old name. No plugin currently seems to make use of this variable yet. The old name 'use_proxy_always' is added when deprecated APIs is enabled. Changelog-Deprecated: Plugins: Renames plugin init 'use_proxy_always' to 'always_use_proxy'
f1f7a70
to
da0440e
Compare
I'm not too sure about the each 30secs ping on TOR connections just yet as there are some open questions:
Also Bolt#1 tells us using frequent lightning protocol pings can raise a problem:
When a connection gets laggy and say its TCP socket suddenly spits out 2minutes of 'old remote data' to the daemon (which happens on TCP over TOR), there may be implementations that then |
It's a separate PR, but I think it would be useful.
My advice: only send a ping if you made the connection (no point both sides doing it, might as well establish a convention).
I think if you're trying to send the next ping and you haven't got the reply from the last, you close the connection.
Well, if we can't get an HTLC committed (add, commit) in 30 seconds we already kill the connection and fail the HTLC, and we won't send the commit unless we've heard from the peer in the last 30 seconds (in which case we ping). So if your connection is slower than that, c-lightning isn't going to work. And while we could extend that, it's pretty unfriendly to the rest of the network.
No, because you are also not supposed to send one until you've got the previous reply. Note that channeld already has some ping logic, and it's probably a good place to start with this for Tor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack da0440e
This does: