if (pss->valid) {
pthread_mutex_lock(&g_ws_server_mutex);
std::queue<ISE_MESSAGE>& messages = agent->get_send_message_queue();
- while (messages.size() > 0) {
+ if (messages.size() > 0) {
ISE_MESSAGE &message = messages.front();
std::string str = CISEMessageSerializer::serialize(message);
LOGD("SEND_WEBSOCKET_MESSAGE : %s", str.c_str());
pthread_mutex_unlock(&g_ws_server_mutex);
if (n < 0) {
- lwsl_err("ERROR %d writing to di socket\n", n);
+ LOGE("ERROR %d writing to di socket\n", n);
return -1;
}
+
+ if (messages.size() > 0) {
+ lws_callback_on_writable_all_protocol(g_ws_server_context, &protocols[PROTOCOL_KEYBOARD]);
+ }
} else {
LOGD("Rejecting data transmission since client is not valid");
}