[net processing] Fix bad indentation in SendMessages()
Hint for reviewers: review ignoring whitespace changes.
This commit is contained in:
1 parent
1a1c23f8d4
commit
a1d5a428a2
1 file changed
+31
-31
+31
-31
@@ -3839,41 +3839,41 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
|
|||||||
{
|
{
|
||||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||||
|
|
||||||
// Don't send anything until the version handshake is complete
|
// Don't send anything until the version handshake is complete
|
||||||
if (!pto->fSuccessfullyConnected || pto->fDisconnect)
|
if (!pto->fSuccessfullyConnected || pto->fDisconnect)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// If we get here, the outgoing message serialization version is set and can't change.
|
// If we get here, the outgoing message serialization version is set and can't change.
|
||||||
const CNetMsgMaker msgMaker(pto->GetSendVersion());
|
const CNetMsgMaker msgMaker(pto->GetSendVersion());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Message: ping
|
// Message: ping
|
||||||
//
|
//
|
||||||
bool pingSend = false;
|
bool pingSend = false;
|
||||||
if (pto->fPingQueued) {
|
if (pto->fPingQueued) {
|
||||||
// RPC ping request by user
|
// RPC ping request by user
|
||||||
pingSend = true;
|
pingSend = true;
|
||||||
|
}
|
||||||
|
if (pto->nPingNonceSent == 0 && pto->m_ping_start.load() + PING_INTERVAL < GetTime<std::chrono::microseconds>()) {
|
||||||
|
// Ping automatically sent as a latency probe & keepalive.
|
||||||
|
pingSend = true;
|
||||||
|
}
|
||||||
|
if (pingSend) {
|
||||||
|
uint64_t nonce = 0;
|
||||||
|
while (nonce == 0) {
|
||||||
|
GetRandBytes((unsigned char*)&nonce, sizeof(nonce));
|
||||||
}
|
}
|
||||||
if (pto->nPingNonceSent == 0 && pto->m_ping_start.load() + PING_INTERVAL < GetTime<std::chrono::microseconds>()) {
|
pto->fPingQueued = false;
|
||||||
// Ping automatically sent as a latency probe & keepalive.
|
pto->m_ping_start = GetTime<std::chrono::microseconds>();
|
||||||
pingSend = true;
|
if (pto->nVersion > BIP0031_VERSION) {
|
||||||
}
|
pto->nPingNonceSent = nonce;
|
||||||
if (pingSend) {
|
connman->PushMessage(pto, msgMaker.Make(NetMsgType::PING, nonce));
|
||||||
uint64_t nonce = 0;
|
} else {
|
||||||
while (nonce == 0) {
|
// Peer is too old to support ping command with nonce, pong will never arrive.
|
||||||
GetRandBytes((unsigned char*)&nonce, sizeof(nonce));
|
pto->nPingNonceSent = 0;
|
||||||
}
|
connman->PushMessage(pto, msgMaker.Make(NetMsgType::PING));
|
||||||
pto->fPingQueued = false;
|
|
||||||
pto->m_ping_start = GetTime<std::chrono::microseconds>();
|
|
||||||
if (pto->nVersion > BIP0031_VERSION) {
|
|
||||||
pto->nPingNonceSent = nonce;
|
|
||||||
connman->PushMessage(pto, msgMaker.Make(NetMsgType::PING, nonce));
|
|
||||||
} else {
|
|
||||||
// Peer is too old to support ping command with nonce, pong will never arrive.
|
|
||||||
pto->nPingNonceSent = 0;
|
|
||||||
connman->PushMessage(pto, msgMaker.Make(NetMsgType::PING));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
|||||||
Reference in new issue
Block a user