close modem socket after joining read thread

This commit is contained in:
Martin Michelsen 2024-02-07 20:50:59 -08:00
parent 9d0d2f0a40
commit 7775ea325f
1 changed files with 4 additions and 4 deletions

View File

@ -130,15 +130,15 @@ bool TAPServerConnection::Activate()
void TAPServerConnection::Deactivate() void TAPServerConnection::Deactivate()
{ {
if (m_fd >= 0)
closesocket(m_fd);
m_fd = -1;
m_read_enabled.Clear(); m_read_enabled.Clear();
m_read_shutdown.Set(); m_read_shutdown.Set();
if (m_read_thread.joinable()) if (m_read_thread.joinable())
m_read_thread.join(); m_read_thread.join();
m_read_shutdown.Clear(); m_read_shutdown.Clear();
if (m_fd >= 0)
closesocket(m_fd);
m_fd = -1;
} }
bool TAPServerConnection::IsActivated() bool TAPServerConnection::IsActivated()