event/SocketEvent: allow Close() without socket

This commit is contained in:
Max Kellermann 2020-10-14 16:23:13 +02:00
parent 7fc04fd5cd
commit 9f013f7de4
2 changed files with 4 additions and 2 deletions

View File

@ -75,8 +75,7 @@ public:
OneServerSocket &operator=(const OneServerSocket &other) = delete;
~OneServerSocket() noexcept {
if (IsDefined())
Close();
Close();
}
[[nodiscard]] unsigned GetSerial() const noexcept {

View File

@ -50,6 +50,9 @@ SocketEvent::Steal() noexcept
void
SocketEvent::Close() noexcept
{
if (!fd.IsDefined())
return;
Steal().Close();
}