fix potential race in socket closure

This commit is contained in:
Martin Michelsen
2025-10-04 09:54:21 -07:00
parent d61cb1106d
commit 2534ff37de
4 changed files with 21 additions and 11 deletions
+7 -1
View File
@@ -189,8 +189,14 @@ public:
return this->sock;
}
inline bool is_open() const {
return this->sock.is_open();
}
inline void close() {
this->sock.close();
if (this->sock.is_open()) {
this->sock.close();
}
}
private: