diff --git a/src/ebusd/network.cpp b/src/ebusd/network.cpp index b4ec6239..8fb86c96 100644 --- a/src/ebusd/network.cpp +++ b/src/ebusd/network.cpp @@ -206,6 +206,10 @@ Network::Network(const bool local, const uint16_t port, const uint16_t httpPort, Network::~Network() { stop(); + NetMessage* netMsg; + while ((netMsg = m_netQueue->pop()) != NULL) { + netMsg->setResult("ERR: shutdown", "", false, 0, true); + } while (!m_connections.empty()) { Connection* connection = m_connections.back(); m_connections.pop_back(); diff --git a/src/ebusd/network.h b/src/ebusd/network.h index 00971b39..e188dab5 100644 --- a/src/ebusd/network.h +++ b/src/ebusd/network.h @@ -103,11 +103,8 @@ class NetMessage { void getResult(string* result) { pthread_mutex_lock(&m_mutex); - while (!m_resultSet) { - int wait = pthread_cond_wait(&m_cond, &m_mutex); - if (wait != 0 && wait != ETIMEDOUT) { - break; - } + if (!m_resultSet) { + pthread_cond_wait(&m_cond, &m_mutex); } m_request.clear(); *result = m_result;