mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-25 20:16:05 +00:00
Revert old Client::close.
This commit is contained in:
parent
9be897eb6b
commit
fe1649a2c1
1 changed files with 2 additions and 28 deletions
|
@ -120,12 +120,7 @@ void Client::deleteLater()
|
||||||
|
|
||||||
m_listener = nullptr;
|
m_listener = nullptr;
|
||||||
|
|
||||||
if (state() == HostLookupState) {
|
if (!disconnect()) {
|
||||||
uv_cancel(reinterpret_cast<uv_req_t*>(&m_resolver));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!disconnect() && m_state != ClosingState) {
|
|
||||||
m_storage.remove(m_key);
|
m_storage.remove(m_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,28 +201,7 @@ bool Client::close()
|
||||||
|
|
||||||
setState(ClosingState);
|
setState(ClosingState);
|
||||||
|
|
||||||
uv_stream_t *stream = reinterpret_cast<uv_stream_t*>(m_socket);
|
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_socket)) == 0) {
|
||||||
|
|
||||||
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<uv_handle_t*>(req->handle)) == 0) {
|
|
||||||
uv_close(reinterpret_cast<uv_handle_t*>(req->handle), Client::onClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete req;
|
|
||||||
});
|
|
||||||
|
|
||||||
assert(rc == 0);
|
|
||||||
|
|
||||||
if (rc != 0) {
|
|
||||||
onClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uv_close(reinterpret_cast<uv_handle_t*>(m_socket), Client::onClose);
|
uv_close(reinterpret_cast<uv_handle_t*>(m_socket), Client::onClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue