TCPServer fixes

- Proper shutdown sequence, uv_close() must be called from the event loop thread
- Moved start_listening() to child class constructor because it must be ready before it can listen on sockets
- Added simple memory leak detector for Windows. Linux users can enjoy the leak sanitizer
This commit is contained in:
SChernykh
2021-08-26 23:27:05 +02:00
parent 27e85a922b
commit 3f1ee9ce4b
7 changed files with 303 additions and 33 deletions
+2 -1
View File
@@ -37,7 +37,7 @@ static constexpr uint64_t DEFAULT_BAN_TIME = 600;
namespace p2pool {
P2PServer::P2PServer(p2pool* pool)
: TCPServer(P2PClient::allocate, pool->params().m_p2pAddresses)
: TCPServer(P2PClient::allocate)
, m_pool(pool)
, m_cache(new BlockCache())
, m_cacheLoaded(false)
@@ -81,6 +81,7 @@ P2PServer::P2PServer(p2pool* pool)
panic();
}
start_listening(pool->params().m_p2pAddresses);
connect_to_peers(pool->params().m_p2pPeerList);
load_saved_peer_list();
}