diff --git a/src/event/SocketEvent.cxx b/src/event/SocketEvent.cxx index a4e04f072..d4cf04bfd 100644 --- a/src/event/SocketEvent.cxx +++ b/src/event/SocketEvent.cxx @@ -53,7 +53,8 @@ SocketEvent::Close() noexcept if (!fd.IsDefined()) return; - loop.AbandonFD(fd.Get()); + if (std::exchange(scheduled_flags, 0) != 0) + loop.AbandonFD(fd.Get()); fd.Close(); }