Do not accidentally clear incorrect osd_peer_fds entries

This commit is contained in:
Vitaliy Filippov
2025-06-05 02:22:13 +03:00
parent 8d2a1f0297
commit a3c1996101
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -72,8 +72,12 @@ void osd_messenger_t::stop_client(int peer_fd, bool force, bool force_delete)
cl->peer_state = PEER_STOPPED;
if (cl->osd_num)
{
// ...and forget OSD peer
osd_peer_fds.erase(cl->osd_num);
auto osd_it = osd_peer_fds.find(cl->osd_num);
if (osd_it != osd_peer_fds.end() && osd_it->second == cl->peer_fd)
{
// ...and forget OSD peer
osd_peer_fds.erase(osd_it);
}
}
#ifndef __MOCK__
// Then remove FD from the eventloop so we don't accidentally read something