Fixed cppcheck error

This commit is contained in:
SChernykh 2023-03-27 11:47:48 +02:00
parent 2e6041dcf5
commit 3697c079fa
2 changed files with 3 additions and 9 deletions

View file

@ -1545,11 +1545,7 @@ bool P2PServer::P2PClient::on_read(char* data, uint32_t size)
m_pingTime = std::max<int64_t>(duration_cast<milliseconds>(high_resolution_clock::now() - m_lastPeerListRequestTime).count(), 0); m_pingTime = std::max<int64_t>(duration_cast<milliseconds>(high_resolution_clock::now() - m_lastPeerListRequestTime).count(), 0);
--m_peerListPendingRequests; --m_peerListPendingRequests;
if (!on_peer_list_response(buf + 1)) { on_peer_list_response(buf + 1);
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
return false;
}
} }
} }
break; break;
@ -2181,7 +2177,7 @@ bool P2PServer::P2PClient::on_peer_list_request(const uint8_t*)
}); });
} }
bool P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf) void P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf)
{ {
P2PServer* server = static_cast<P2PServer*>(m_owner); P2PServer* server = static_cast<P2PServer*>(m_owner);
const uint64_t cur_time = seconds_since_epoch(); const uint64_t cur_time = seconds_since_epoch();
@ -2242,8 +2238,6 @@ bool P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf)
server->m_peerList.emplace_back(Peer{ is_v6, ip, port, 0, cur_time }); server->m_peerList.emplace_back(Peer{ is_v6, ip, port, 0, cur_time });
} }
} }
return true;
} }
bool P2PServer::P2PClient::handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta) bool P2PServer::P2PClient::handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta)

View file

@ -104,7 +104,7 @@ public:
bool on_block_response(const uint8_t* buf, uint32_t size, const hash& expected_id); bool on_block_response(const uint8_t* buf, uint32_t size, const hash& expected_id);
bool on_block_broadcast(const uint8_t* buf, uint32_t size, bool compact); bool on_block_broadcast(const uint8_t* buf, uint32_t size, bool compact);
bool on_peer_list_request(const uint8_t* buf); bool on_peer_list_request(const uint8_t* buf);
bool on_peer_list_response(const uint8_t* buf); void on_peer_list_response(const uint8_t* buf);
bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0); bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0);
void handle_incoming_block(p2pool* pool, PoolBlock& block, const uint32_t reset_counter, const raw_ip& addr, std::vector<hash>& missing_blocks); void handle_incoming_block(p2pool* pool, PoolBlock& block, const uint32_t reset_counter, const raw_ip& addr, std::vector<hash>& missing_blocks);