1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix: fix replica closing socket (#1167)

Fix closing replica socket
This commit is contained in:
Vladislav 2023-05-01 12:38:20 +03:00 committed by GitHub
parent 300ccf3218
commit 3fd4e277d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -739,8 +739,11 @@ void Replica::CloseSocket() {
unique_lock lk(sock_mu_);
if (sock_) {
sock_->proactor()->Await([this] {
auto ec = sock_->Shutdown(SHUT_RDWR);
LOG_IF(ERROR, ec) << "Could not shutdown socket " << ec;
if (sock_->IsOpen()) {
auto ec = sock_->Shutdown(SHUT_RDWR);
LOG_IF(ERROR, ec) << "Could not shutdown socket " << ec;
sock_->Close();
}
});
}
}