Fixed TCPServer startup

This commit is contained in:
SChernykh 2021-08-27 00:19:01 +02:00
parent 3f1ee9ce4b
commit f77e0434c6

View file

@ -53,12 +53,6 @@ TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::TCPServer(allocate_client_callback all
m_connectedClientsList = m_allocateNewClient(); m_connectedClientsList = m_allocateNewClient();
m_connectedClientsList->m_next = m_connectedClientsList; m_connectedClientsList->m_next = m_connectedClientsList;
m_connectedClientsList->m_prev = m_connectedClientsList; m_connectedClientsList->m_prev = m_connectedClientsList;
err = uv_thread_create(&m_loopThread, loop, this);
if (err) {
LOGERR(1, "failed to start event loop thread, error " << uv_err_name(err));
panic();
}
} }
template<size_t READ_BUF_SIZE, size_t WRITE_BUF_SIZE> template<size_t READ_BUF_SIZE, size_t WRITE_BUF_SIZE>
@ -197,6 +191,12 @@ void TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::start_listening(const std::string
LOGINFO(1, "listening on " << log::Gray() << address); LOGINFO(1, "listening on " << log::Gray() << address);
}); });
const int err = uv_thread_create(&m_loopThread, loop, this);
if (err) {
LOGERR(1, "failed to start event loop thread, error " << uv_err_name(err));
panic();
}
} }
template<size_t READ_BUF_SIZE, size_t WRITE_BUF_SIZE> template<size_t READ_BUF_SIZE, size_t WRITE_BUF_SIZE>