Got tired of telling pool ops to not use hub mode and use -addnode and adding a little asterisk that it would be nice if addnode kept the node connected as a "Bitcoin backbone" should do, so I hacked an implementation together.
Add -keepnode which attempts to -addnode and keep a connection open #454
pull TheBlueMatt wants to merge 2 commits into bitcoin:master from TheBlueMatt:keepnode changing 4 files +100 −24-
TheBlueMatt commented at 10:14 PM on August 5, 2011: member
-
luke-jr commented at 7:39 PM on December 2, 2011: member
ACK
-
TheBlueMatt commented at 1:52 AM on December 9, 2011: member
Updated version, now with less redundant code and less potential to segfault in very rare cases.
-
TheBlueMatt commented at 2:13 AM on December 9, 2011: member
After discussion on #bitcoin-dev, no more exponential backoff and retry connections every 2 minutes.
-
gavinandresen commented at 8:12 PM on December 19, 2011: contributor
Is there a good reason for this to be a separate switch? I think I'd prefer if we just changed the -addnode behavior to stay connected.
-
TheBlueMatt commented at 8:18 PM on December 19, 2011: member
not really, I just always prefer to not change existing behavior, but if there is a consensus that -addnode in its current for is unnecessary, thats fine.
-
TheBlueMatt commented at 12:41 AM on January 6, 2012: member
-addnode removed, s/keepnode/addnode/
-
luke-jr commented at 8:43 PM on January 12, 2012: member
This needs rebasing again. Not trivial this time. :(
-
TheBlueMatt commented at 9:19 PM on January 12, 2012: member
Rebased, and it was trivial.
-
luke-jr commented at 10:20 PM on January 12, 2012: member
No, it isn't that trivial. This still does not build.
-
TheBlueMatt commented at 2:52 AM on January 13, 2012: member
OK, theres an actually useful version.
-
Add -keepnode which attempts to -addnode and keep a connection open b24e6e4d1b
-
Minor code cleanup to use fHaveUPnP instead of #ifdef 10ba0a3efc
-
luke-jr commented at 4:00 AM on January 13, 2012: member
The cleanup really doesn't belong here, but it looks fine to me... ACK on 10ba0a3 (Minor cleanup...)
-
TheBlueMatt commented at 4:07 AM on January 13, 2012: member
Sorry, I wrote that patch while writing keepnode and its way too small to warrant its own pull request, so I just left it in here...
-
gavinandresen commented at 3:04 PM on January 13, 2012: contributor
This doesn't work for me.
How I tested:
3 testnet-in-a-box nodes, a/b/c listening on ports 8900,8901,8902
b -connects to a c -connects to a and also -addnode's b
Test: start them all up, verify c's connections. Shutdown b. Then restart b, and see how long it takes c to reconnect. I waited a long time.
I think the culprit is: Sleep(120000); // Retry every 2 minutes
... which I believe is 20 minutes, not two.
-
TheBlueMatt commented at 7:28 PM on January 13, 2012: member
No, 120,000 is correct (http://www.wolframalpha.com/input/?i=2+minutes+to+milliseconds), also it worked fine for me... I just ran two regular nodes with -connect=0.0.0.0 and one with -addnode=127.0.0.1:8334 (the second started after the first) and 2 minutes after it first tried its connection, it connected just fine. Care to run in gdb?
-
gavinandresen commented at 10:06 PM on January 16, 2012: contributor
ACK-- problem with my test is elsewhere in the networking code, I can't make more than one connection from daemons running on my machine on different ports.
- gavinandresen merged this on Jan 16, 2012
- gavinandresen closed this on Jan 16, 2012
- zathras-crypto referenced this in commit c01dae8717 on Feb 3, 2017
- ptschip referenced this in commit 54bd06ba84 on May 2, 2017
- sipa referenced this in commit e7c1b4490f on May 5, 2017
- protonn referenced this in commit 7ad913b4b1 on Nov 1, 2017
- lateminer referenced this in commit 79e7a13b07 on Jan 22, 2019
- fjahr referenced this in commit 84973d393a on Jul 24, 2019
- DrahtBot locked this on Sep 8, 2021