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() {
|
Network::~Network() {
|
||||||
stop();
|
stop();
|
||||||
|
NetMessage* netMsg;
|
||||||
|
while ((netMsg = m_netQueue->pop()) != NULL) {
|
||||||
|
netMsg->setResult("ERR: shutdown", "", false, 0, true);
|
||||||
|
}
|
||||||
while (!m_connections.empty()) {
|
while (!m_connections.empty()) {
|
||||||
Connection* connection = m_connections.back();
|
Connection* connection = m_connections.back();
|
||||||
m_connections.pop_back();
|
m_connections.pop_back();
|
||||||
|
|||||||
+2
-5
@@ -103,11 +103,8 @@ class NetMessage {
|
|||||||
void getResult(string* result) {
|
void getResult(string* result) {
|
||||||
pthread_mutex_lock(&m_mutex);
|
pthread_mutex_lock(&m_mutex);
|
||||||
|
|
||||||
while (!m_resultSet) {
|
if (!m_resultSet) {
|
||||||
int wait = pthread_cond_wait(&m_cond, &m_mutex);
|
pthread_cond_wait(&m_cond, &m_mutex);
|
||||||
if (wait != 0 && wait != ETIMEDOUT) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_request.clear();
|
m_request.clear();
|
||||||
*result = m_result;
|
*result = m_result;
|
||||||
|
|||||||
Reference in New Issue
Block a user