X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Faddrman.cpp;h=8257a46a1587fcd0cf6ea6ff991cce45794fbe27;hp=c1a0df6a44d4140e9eebdc1cec3dcadd370c4c9d;hb=e10622d1297e638109bbf58c35ad008f7acbae7c;hpb=dfdaee931021618fa2d280907aad7393640f39f5 diff --git a/src/addrman.cpp b/src/addrman.cpp index c1a0df6..8257a46 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2012 Pieter Wuille // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "addrman.h" @@ -130,6 +130,7 @@ int CAddrMan::SelectTried(int nKBucket) // random shuffle the first few elements (using the entire list) // find the least recently tried among them int64 nOldest = -1; + int nOldestPos = -1; for (unsigned int i = 0; i < ADDRMAN_TRIED_ENTRIES_INSPECT_ON_EVICT && i < vTried.size(); i++) { int nPos = GetRandInt(vTried.size() - i) + i; @@ -137,11 +138,13 @@ int CAddrMan::SelectTried(int nKBucket) vTried[nPos] = vTried[i]; vTried[i] = nTemp; assert(nOldest == -1 || mapInfo.count(nTemp) == 1); - if (nOldest == -1 || mapInfo[nTemp].nLastSuccess < mapInfo[nOldest].nLastSuccess) + if (nOldest == -1 || mapInfo[nTemp].nLastSuccess < mapInfo[nOldest].nLastSuccess) { nOldest = nTemp; + nOldestPos = nPos; + } } - return nOldest; + return nOldestPos; } int CAddrMan::ShrinkNew(int nUBucket)