Show error message instead of exception crash when unable to bind RPC port #1046

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2012_04_rpcporterror changing 1 files +15 −3
  1. laanwj commented at 6:48 PM on April 5, 2012: member

    Fixes issue #875

  2. gavinandresen commented at 7:12 PM on April 5, 2012: contributor

    ACK

  3. Show error message instead of exception crash when unable to bind RPC port
    Fixes issue #875
    3e34352222
  4. in src/bitcoinrpc.cpp:None in 5c60de299f outdated
    2383 | +    ip::tcp::acceptor acceptor(io_service);
    2384 | +    try
    2385 | +    {
    2386 | +        acceptor.open(endpoint.protocol());
    2387 | +        acceptor.bind(endpoint);
    2388 | +        acceptor.set_option(socket_base::reuse_address(true));
    


    luke-jr commented at 4:22 PM on April 6, 2012:

    Why socket_base instead of boost::asio::ip::tcp::acceptor (as in current code)?


    laanwj commented at 4:36 PM on April 6, 2012:

    boost itself uses socket_base::reuse_address internally, but that's fine with me too

  5. in src/bitcoinrpc.cpp:None in 5c60de299f outdated
    2382 | -    acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
    2383 | +    ip::tcp::acceptor acceptor(io_service);
    2384 | +    try
    2385 | +    {
    2386 | +        acceptor.open(endpoint.protocol());
    2387 | +        acceptor.bind(endpoint);
    


    luke-jr commented at 4:24 PM on April 6, 2012:

    Any reason not to bind after setting reuse_address (like boost itself does)?


    laanwj commented at 4:34 PM on April 6, 2012:

    yes that would be more logical order

  6. laanwj commented at 7:04 PM on April 6, 2012: member

    I've updated the code to take @luke-jr's suggestions into account

  7. luke-jr commented at 7:08 PM on April 6, 2012: member

    Visual ACK

  8. jgarzik commented at 7:32 PM on April 10, 2012: contributor

    ACK

  9. laanwj referenced this in commit b56772e5df on Apr 10, 2012
  10. laanwj merged this on Apr 10, 2012
  11. laanwj closed this on Apr 10, 2012

  12. coblee referenced this in commit f5df100d90 on Jul 17, 2012
  13. laanwj deleted the branch on Apr 9, 2014
  14. suprnurd referenced this in commit 4316b4e277 on Dec 5, 2017
  15. sanch0panza referenced this in commit e19983c42d on May 17, 2018
  16. 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-13 15:16 UTC

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