@@ -323,7 +323,7 @@ class PeerManagerImpl final : public PeerManager
323
323
void MaybeSendPing (CNode& node_to, Peer& peer, std::chrono::microseconds now);
324
324
325
325
/* * Send `addr` messages on a regular schedule. */
326
- void MaybeSendAddr (CNode* pto , std::chrono::microseconds current_time);
326
+ void MaybeSendAddr (CNode& node , std::chrono::microseconds current_time);
327
327
328
328
const CChainParams& m_chainparams;
329
329
CConnman& m_connman;
@@ -4141,69 +4141,69 @@ void PeerManagerImpl::MaybeSendPing(CNode& node_to, Peer& peer, std::chrono::mic
4141
4141
}
4142
4142
}
4143
4143
4144
- void PeerManagerImpl::MaybeSendAddr (CNode* pto , std::chrono::microseconds current_time)
4144
+ void PeerManagerImpl::MaybeSendAddr (CNode& node , std::chrono::microseconds current_time)
4145
4145
{
4146
- LOCK (pto-> m_addr_send_times_mutex );
4147
- const CNetMsgMaker msgMaker (pto-> GetCommonVersion ());
4146
+ LOCK (node. m_addr_send_times_mutex );
4147
+ const CNetMsgMaker msgMaker (node. GetCommonVersion ());
4148
4148
4149
- if (fListen && pto-> RelayAddrsWithConn () &&
4149
+ if (fListen && node. RelayAddrsWithConn () &&
4150
4150
!m_chainman.ActiveChainstate ().IsInitialBlockDownload () &&
4151
- pto-> m_next_local_addr_send < current_time) {
4151
+ node. m_next_local_addr_send < current_time) {
4152
4152
// If we've sent before, clear the bloom filter for the peer, so that our
4153
4153
// self-announcement will actually go out.
4154
4154
// This might be unnecessary if the bloom filter has already rolled
4155
4155
// over since our last self-announcement, but there is only a small
4156
4156
// bandwidth cost that we can incur by doing this (which happens
4157
4157
// once a day on average).
4158
- if (pto-> m_next_local_addr_send != 0us) {
4159
- pto-> m_addr_known ->reset ();
4158
+ if (node. m_next_local_addr_send != 0us) {
4159
+ node. m_addr_known ->reset ();
4160
4160
}
4161
- if (std::optional<CAddress> local_addr = GetLocalAddrForPeer (pto )) {
4161
+ if (std::optional<CAddress> local_addr = GetLocalAddrForPeer (&node )) {
4162
4162
FastRandomContext insecure_rand;
4163
- pto-> PushAddress (*local_addr, insecure_rand);
4163
+ node. PushAddress (*local_addr, insecure_rand);
4164
4164
}
4165
- pto-> m_next_local_addr_send = PoissonNextSend (current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
4165
+ node. m_next_local_addr_send = PoissonNextSend (current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
4166
4166
}
4167
4167
4168
4168
//
4169
4169
// Message: addr
4170
4170
//
4171
- if (pto-> RelayAddrsWithConn () && pto-> m_next_addr_send < current_time) {
4172
- pto-> m_next_addr_send = PoissonNextSend (current_time, AVG_ADDRESS_BROADCAST_INTERVAL);
4171
+ if (node. RelayAddrsWithConn () && node. m_next_addr_send < current_time) {
4172
+ node. m_next_addr_send = PoissonNextSend (current_time, AVG_ADDRESS_BROADCAST_INTERVAL);
4173
4173
std::vector<CAddress> vAddr;
4174
- vAddr.reserve (pto-> vAddrToSend .size ());
4175
- assert (pto-> m_addr_known );
4174
+ vAddr.reserve (node. vAddrToSend .size ());
4175
+ assert (node. m_addr_known );
4176
4176
4177
4177
const char * msg_type;
4178
4178
int make_flags;
4179
- if (pto-> m_wants_addrv2 ) {
4179
+ if (node. m_wants_addrv2 ) {
4180
4180
msg_type = NetMsgType::ADDRV2;
4181
4181
make_flags = ADDRV2_FORMAT;
4182
4182
} else {
4183
4183
msg_type = NetMsgType::ADDR;
4184
4184
make_flags = 0 ;
4185
4185
}
4186
4186
4187
- for (const CAddress& addr : pto-> vAddrToSend )
4187
+ for (const CAddress& addr : node. vAddrToSend )
4188
4188
{
4189
- if (!pto-> m_addr_known ->contains (addr.GetKey ()))
4189
+ if (!node. m_addr_known ->contains (addr.GetKey ()))
4190
4190
{
4191
- pto-> m_addr_known ->insert (addr.GetKey ());
4191
+ node. m_addr_known ->insert (addr.GetKey ());
4192
4192
vAddr.push_back (addr);
4193
4193
// receiver rejects addr messages larger than MAX_ADDR_TO_SEND
4194
4194
if (vAddr.size () >= MAX_ADDR_TO_SEND)
4195
4195
{
4196
- m_connman.PushMessage (pto , msgMaker.Make (make_flags, msg_type, vAddr));
4196
+ m_connman.PushMessage (&node , msgMaker.Make (make_flags, msg_type, vAddr));
4197
4197
vAddr.clear ();
4198
4198
}
4199
4199
}
4200
4200
}
4201
- pto-> vAddrToSend .clear ();
4201
+ node. vAddrToSend .clear ();
4202
4202
if (!vAddr.empty ())
4203
- m_connman.PushMessage (pto , msgMaker.Make (make_flags, msg_type, vAddr));
4203
+ m_connman.PushMessage (&node , msgMaker.Make (make_flags, msg_type, vAddr));
4204
4204
// we only send the big addr message once
4205
- if (pto-> vAddrToSend .capacity () > 40 )
4206
- pto-> vAddrToSend .shrink_to_fit ();
4205
+ if (node. vAddrToSend .capacity () > 40 )
4206
+ node. vAddrToSend .shrink_to_fit ();
4207
4207
}
4208
4208
}
4209
4209
@@ -4252,7 +4252,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
4252
4252
// MaybeSendPing may have marked peer for disconnection
4253
4253
if (pto->fDisconnect ) return true ;
4254
4254
4255
- MaybeSendAddr (pto, current_time);
4255
+ MaybeSendAddr (* pto, current_time);
4256
4256
4257
4257
{
4258
4258
LOCK (cs_main);
0 commit comments