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
  1. TheBlueMatt commented at 10:14 PM on August 5, 2011: member

    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.

  2. luke-jr commented at 7:39 PM on December 2, 2011: member

    ACK

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. TheBlueMatt commented at 12:41 AM on January 6, 2012: member

    -addnode removed, s/keepnode/addnode/

  8. luke-jr commented at 8:43 PM on January 12, 2012: member

    This needs rebasing again. Not trivial this time. :(

  9. TheBlueMatt commented at 9:19 PM on January 12, 2012: member

    Rebased, and it was trivial.

  10. luke-jr commented at 10:20 PM on January 12, 2012: member

    No, it isn't that trivial. This still does not build.

  11. TheBlueMatt commented at 2:52 AM on January 13, 2012: member

    OK, theres an actually useful version.

  12. Add -keepnode which attempts to -addnode and keep a connection open b24e6e4d1b
  13. Minor code cleanup to use fHaveUPnP instead of #ifdef 10ba0a3efc
  14. 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...)

  15. 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...

  16. 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.

  17. 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?

  18. 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.

  19. gavinandresen merged this on Jan 16, 2012
  20. gavinandresen closed this on Jan 16, 2012

  21. zathras-crypto referenced this in commit c01dae8717 on Feb 3, 2017
  22. ptschip referenced this in commit 54bd06ba84 on May 2, 2017
  23. sipa referenced this in commit e7c1b4490f on May 5, 2017
  24. protonn referenced this in commit 7ad913b4b1 on Nov 1, 2017
  25. lateminer referenced this in commit 79e7a13b07 on Jan 22, 2019
  26. fjahr referenced this in commit 84973d393a on Jul 24, 2019
  27. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me