fix for shutdown
This commit is contained in:
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user