diff --git a/src/net/Client.cpp b/src/net/Client.cpp index c4387a7c7..436bcd1a5 100644 --- a/src/net/Client.cpp +++ b/src/net/Client.cpp @@ -120,12 +120,7 @@ void Client::deleteLater() m_listener = nullptr; - if (state() == HostLookupState) { - uv_cancel(reinterpret_cast(&m_resolver)); - return; - } - - if (!disconnect() && m_state != ClosingState) { + if (!disconnect()) { m_storage.remove(m_key); } } @@ -206,28 +201,7 @@ bool Client::close() setState(ClosingState); - uv_stream_t *stream = reinterpret_cast(m_socket); - - if (uv_is_readable(stream) == 1) { - uv_read_stop(stream); - } - - if (uv_is_writable(stream) == 1) { - const int rc = uv_shutdown(new uv_shutdown_t, stream, [](uv_shutdown_t* req, int status) { - if (uv_is_closing(reinterpret_cast(req->handle)) == 0) { - uv_close(reinterpret_cast(req->handle), Client::onClose); - } - - delete req; - }); - - assert(rc == 0); - - if (rc != 0) { - onClose(); - } - } - else { + if (uv_is_closing(reinterpret_cast(m_socket)) == 0) { uv_close(reinterpret_cast(m_socket), Client::onClose); }