Skip to content

Commit b9311fb

Browse files
committed
Merge pull request #6028
1d5b47a nLastTry is only used for addrman entries (Pieter Wuille)
2 parents 585b5db + 1d5b47a commit b9311fb

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

src/addrman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ void CAddrMan::Attempt_(const CService& addr, int64_t nTime)
331331
info.nAttempts++;
332332
}
333333

334-
CAddress CAddrMan::Select_()
334+
CAddrInfo CAddrMan::Select_()
335335
{
336336
if (size() == 0)
337-
return CAddress();
337+
return CAddrInfo();
338338

339339
// Use a 50% chance for choosing between tried and new table entries.
340340
if (nTried > 0 && (nNew == 0 || GetRandInt(2) == 0)) {

src/addrman.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@
2222
*/
2323
class CAddrInfo : public CAddress
2424
{
25+
public:
26+
//! last try whatsoever by us (memory only)
27+
int64_t nLastTry;
28+
2529
private:
2630
//! where knowledge about this address first came from
2731
CNetAddr source;
2832

2933
//! last successful connection by us
3034
int64_t nLastSuccess;
3135

32-
//! last try whatsoever by us:
33-
// int64_t CAddress::nLastTry
34-
3536
//! connection attempts since last successful attempt
3637
int nAttempts;
3738

@@ -231,7 +232,7 @@ class CAddrMan
231232

232233
//! Select an address to connect to.
233234
//! nUnkBias determines how much to favor new addresses over tried ones (min=0, max=100)
234-
CAddress Select_();
235+
CAddrInfo Select_();
235236

236237
#ifdef DEBUG_ADDRMAN
237238
//! Perform consistency check. Returns an error code or zero.
@@ -533,9 +534,9 @@ class CAddrMan
533534
* Choose an address to connect to.
534535
* nUnkBias determines how much "new" entries are favored over "tried" ones (0-100).
535536
*/
536-
CAddress Select()
537+
CAddrInfo Select()
537538
{
538-
CAddress addrRet;
539+
CAddrInfo addrRet;
539540
{
540541
LOCK(cs);
541542
Check();

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ void ThreadOpenConnections()
12211221
int nTries = 0;
12221222
while (true)
12231223
{
1224-
CAddress addr = addrman.Select();
1224+
CAddrInfo addr = addrman.Select();
12251225

12261226
// if we selected an invalid address, restart
12271227
if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))

src/protocol.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ void CAddress::Init()
8989
{
9090
nServices = NODE_NETWORK;
9191
nTime = 100000000;
92-
nLastTry = 0;
9392
}
9493

9594
CInv::CInv()

src/protocol.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ class CAddress : public CService
116116

117117
// disk and network only
118118
unsigned int nTime;
119-
120-
// memory only
121-
int64_t nLastTry;
122119
};
123120

124121
/** inv message data */

0 commit comments

Comments
 (0)