prevent SOCKET leak in BindListenPort() #4551

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:socket_leak changing 1 files +2 −0
  1. Diapolo commented at 8:39 PM on July 17, 2014: none
    • the call to CloseSocket() is placed after the WSAGetLastError(), because a CloseSocket() can trigger an error also, which we don't want for the logging in this two cases
  2. Diapolo renamed this:
    prevent SOCKET leack in BindListenPort()
    prevent SOCKET leak in BindListenPort()
    on Jul 17, 2014
  3. prevent SOCKET leak in BindListenPort()
    - the call to CloseSocket() is placed after the WSAGetLastError(), because
      a CloseSocket() can trigger an error also, which we don't want for the
      logging in this two cases
    c994d2e769
  4. in src/net.cpp:None in 18cd115d7b outdated
    1672 | @@ -1673,6 +1673,7 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste
    1673 |      if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
    1674 |      {
    1675 |          int nErr = WSAGetLastError();
    1676 | +        CloseSocket(hListenSocket);
    


    laanwj commented at 8:45 PM on July 17, 2014:

    Good catch. I'd prefer put the CloseSocket(...) just before the return false;, instead of interleaving it with the logging/error code (same comment for the change below).


    Diapolo commented at 8:49 PM on July 17, 2014:

    Thanks, changed to what you suggested :).

  5. BitcoinPullTester commented at 10:02 PM on July 17, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4551_c994d2e769239036626fe51c59daea4085fc3d54/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  6. laanwj commented at 8:45 AM on July 18, 2014: member

    ACK

  7. laanwj merged this on Jul 18, 2014
  8. laanwj closed this on Jul 18, 2014

  9. laanwj referenced this in commit d3cb2b8acf on Jul 18, 2014
  10. Diapolo deleted the branch on Jul 19, 2014
  11. MarcoFalke 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-21 18:15 UTC

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