diff --git a/client/app.cpp b/client/app.cpp index de4cc52d38..0cf22ac256 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -787,39 +787,44 @@ void MSG_QUEUE::init(char* n) { void MSG_QUEUE::msg_queue_send(const char* msg, MSG_CHANNEL& channel) { if ((msgs.size()==0) && channel.send_msg(msg)) { if (log_flags.app_msg_send) { - msg_printf(NULL, MSG_INFO, "[app_msg_send] sent %s to %s", msg, name); + msg_printf(NULL, MSG_INFO, + "[app_msg_send] sent %s to %s", msg, name + ); } last_block = 0; return; } if (log_flags.app_msg_send) { - msg_printf(NULL, MSG_INFO, "[app_msg_send] deferred %s to %s", msg, name); + msg_printf(NULL, MSG_INFO, + "[app_msg_send] deferred %s to %s", msg, name + ); } - msgs.push_back(std::string(msg)); + msgs.push_back(string(msg)); if (!last_block) last_block = gstate.now; } void MSG_QUEUE::msg_queue_poll(MSG_CHANNEL& channel) { - if (msgs.size() > 0) { + if (msgs.empty()) return; + if (log_flags.app_msg_send) { + msg_printf(NULL, MSG_INFO, + "[app_msg_send] poll: %d msgs queued for %s:", + (int)msgs.size(), name + ); + } + if (channel.send_msg(msgs[0].c_str())) { if (log_flags.app_msg_send) { msg_printf(NULL, MSG_INFO, - "[app_msg_send] poll: %d msgs queued for %s:", - (int)msgs.size(), name + "[app_msg_send] poll: delayed sent %s", msgs[0].c_str() ); } - if (channel.send_msg(msgs[0].c_str())) { - if (log_flags.app_msg_send) { - msg_printf(NULL, MSG_INFO, "[app_msg_send] poll: delayed sent %s", (msgs[0].c_str())); - } - msgs.erase(msgs.begin()); - last_block = 0; - } - for (unsigned int i=0; i::iterator iter = msgs.begin(); - for (int i=0; ic_str(), name + msg, last_msg.c_str(), name ); } - if (!strcmp(msg, iter->c_str())) { + if (!strcmp(msg, last_msg.c_str())) { if (log_flags.app_msg_send) { - msg_printf(NULL, MSG_INFO, "[app_msg_send] purged %s from %s", msg, name); + msg_printf(NULL, MSG_INFO, + "[app_msg_send] purged %s from %s", msg, name + ); } - iter = msgs.erase(iter); + msgs.pop_back(); return 1; } return 0; diff --git a/client/app_control.cpp b/client/app_control.cpp index ffdd629863..651baf9ebb 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -1083,8 +1083,9 @@ void ACTIVE_TASK_SET::kill_tasks(PROJECT* proj) { int ACTIVE_TASK::suspend() { if (!app_client_shm.shm) return 0; if (task_state() != PROCESS_EXECUTING) { - msg_printf(result->project, MSG_INFO, - "Internal error: expected process %s to be executing", result->name + msg_printf(result->project, MSG_INTERNAL_ERROR, + "ACTIVE_TASK::SUSPEND(): expected task %s to be executing", + result->name ); } int n = process_control_queue.msg_queue_purge("");