TCPServer: added thread check on connection close

pull/277/head
SChernykh 2023-09-03 23:12:37 +02:00
parent 6eff190f87
commit cfddaf1508
1 changed files with 3 additions and 1 deletions

View File

@ -419,6 +419,7 @@ void TCPServer::check_event_loop_thread(const char* func) const
{ {
if (server_event_loop_thread != this) { if (server_event_loop_thread != this) {
LOGERR(1, func << " called from another thread, this is not thread safe"); LOGERR(1, func << " called from another thread, this is not thread safe");
PANIC_STOP();
} }
} }
#endif #endif
@ -1213,9 +1214,10 @@ void TCPServer::Client::close()
// Already closed // Already closed
return; return;
} }
m_isClosing = true; m_isClosing = true;
m_owner->check_event_loop_thread(__func__);
uv_read_stop(reinterpret_cast<uv_stream_t*>(&m_socket)); uv_read_stop(reinterpret_cast<uv_stream_t*>(&m_socket));
uv_tcp_t* s = &m_socket; uv_tcp_t* s = &m_socket;