fix for shutdown

This commit is contained in:
john30
2017-05-25 13:09:54 +02:00
parent 606292acda
commit 8f4e1bc865
2 changed files with 6 additions and 5 deletions
+4
View File
@@ -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();
+2 -5
View File
@@ -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;