Exit if server startup fails

This commit is contained in:
SChernykh 2022-05-23 15:46:15 +02:00
parent b191962d32
commit 0e222afd6a
3 changed files with 12 additions and 4 deletions

View file

@ -77,7 +77,7 @@ P2PServer::P2PServer(p2pool* pool)
int err = uv_async_init(&m_loop, &m_broadcastAsync, on_broadcast); int err = uv_async_init(&m_loop, &m_broadcastAsync, on_broadcast);
if (err) { if (err) {
LOGERR(1, "uv_async_init failed, error " << uv_err_name(err)); LOGERR(1, "uv_async_init failed, error " << uv_err_name(err));
return; panic();
} }
m_broadcastAsync.data = this; m_broadcastAsync.data = this;
m_broadcastQueue.reserve(2); m_broadcastQueue.reserve(2);

View file

@ -70,7 +70,7 @@ StratumServer::StratumServer(p2pool* pool)
const int err = uv_async_init(&m_loop, &m_blobsAsync, on_blobs_ready); const int err = uv_async_init(&m_loop, &m_blobsAsync, on_blobs_ready);
if (err) { if (err) {
LOGERR(1, "uv_async_init failed, error " << uv_err_name(err)); LOGERR(1, "uv_async_init failed, error " << uv_err_name(err));
return; panic();
} }
m_blobsAsync.data = this; m_blobsAsync.data = this;
m_blobsQueue.reserve(2); m_blobsQueue.reserve(2);

View file

@ -37,10 +37,18 @@ TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::TCPServer(allocate_client_callback all
panic(); panic();
} }
uv_async_init(&m_loop, &m_dropConnectionsAsync, on_drop_connections); err = uv_async_init(&m_loop, &m_dropConnectionsAsync, on_drop_connections);
if (err) {
LOGERR(1, "uv_async_init failed, error " << uv_err_name(err));
panic();
}
m_dropConnectionsAsync.data = this; m_dropConnectionsAsync.data = this;
uv_async_init(&m_loop, &m_shutdownAsync, on_shutdown); err = uv_async_init(&m_loop, &m_shutdownAsync, on_shutdown);
if (err) {
LOGERR(1, "uv_async_init failed, error " << uv_err_name(err));
panic();
}
m_shutdownAsync.data = this; m_shutdownAsync.data = this;
uv_mutex_init_checked(&m_clientsListLock); uv_mutex_init_checked(&m_clientsListLock);