Fix: always check before closing TCP handles

This commit is contained in:
SChernykh
2021-09-13 19:11:59 +02:00
parent 4c5144b37f
commit 14e26f5c17
2 changed files with 16 additions and 5 deletions

View File

@@ -216,8 +216,10 @@ void JSONRPCRequest::on_read(const char* data, size_t size)
void JSONRPCRequest::close()
{
uv_tcp_t* s = &m_socket;
uv_close(reinterpret_cast<uv_handle_t*>(s), on_close);
uv_handle_t* h = reinterpret_cast<uv_handle_t*>(&m_socket);
if (!uv_is_closing(h)) {
uv_close(h, on_close);
}
}
void JSONRPCRequest::on_close(uv_handle_t* handle)