//============================================================================= // METHOD: SPELLclient:: //============================================================================= SPELLipcMessage SPELLclient::sendRequestToClient( const SPELLipcMessage& msg ) { TICK_IN; SPELLipcMessage result = VOID_MESSAGE; DEBUG( NAME + "Send request to client: " + msg.dataStr() ); result = m_clientIPC.sendRequest( getClientKey(), msg, m_ipcTimeoutGuiRequestMsec ); DEBUG( NAME + "Response for request to client: " + result.dataStr() ); TICK_OUT; return result; }
//============================================================================= // METHOD: SPELLipcMessageMailbox::place //============================================================================= bool SPELLipcMessageMailbox::place( std::string id, const SPELLipcMessage& msg ) { DEBUG(NAME + "Place message on queue with id " + id + " (" + msg.getSequenceStr() + ")"); SPELLipcMessageQueue* queue = getQueue(id); if(queue) { DEBUG(NAME + "Place message IN"); queue->push(msg); DEBUG(NAME + "Place message OUT"); return true; } else { LOG_ERROR("###### No queue to place response " + msg.dataStr()); return false; } }
//============================================================================= // METHOD: SPELLexecutorIPC:: //============================================================================= void SPELLexecutorIPC::processMessage( const SPELLipcMessage& msg ) { TICK_IN; DEBUG("[EXCIPC] Received message from executor: " + msg.dataStr()); // Certain messages are for monitoring clients only if ((msg.getId() != MessageId::MSG_ID_PROMPT_START)&&(msg.getId() != MessageId::MSG_ID_PROMPT_END)) { DEBUG("[EXCIPC] Forward message to controller"); m_controller.processMessageFromExecutor(msg); } if (msg.getId() != ExecutorMessages::MSG_NOTIF_EXEC_CLOSE) { DEBUG("[EXCIPC] Forward message to monitoring clients"); notifyMessage(msg); } DEBUG("[EXCIPC] Message processed"); TICK_OUT; }
//============================================================================= // METHOD: SPELLexecutorIPC:: //============================================================================= SPELLipcMessage SPELLexecutorIPC::processRequest( const SPELLipcMessage& msg ) { TICK_IN; DEBUG("[EXCIPC] Received request from executor: " + msg.dataStr()); SPELLipcMessage resp = VOID_MESSAGE; DEBUG("[EXCIPC] Forward request to controller"); resp = m_controller.processRequestFromExecutor(msg); // Certain requests are to be sent to controlling clients only if ( shouldForwardToMonitoring(msg) ) { DEBUG("[EXCIPC] Forward to monitoring clients"); // Notify request notifyRequest(msg); } DEBUG("[EXCIPC] Request processed"); TICK_OUT; return resp; }
//============================================================================= // METHOD: SPELLlistenerContext::displace //============================================================================= SPELLipcMessage SPELLlistenerContext::displace( const SPELLipcMessage& msg ) { SPELLipcMessage res = VOID_MESSAGE; std::string name; DEBUG("Got IPC object: " + msg.getId()); if (msg.getId() == ContextMessages::REQ_OPEN_CTX) res = this->startContext(msg); else if (msg.getId() == ContextMessages::REQ_CLOSE_CTX) res = this->stopContext(msg); else if (msg.getId() == ContextMessages::REQ_CTX_INFO) res = this->contextInfo(msg); else if (msg.getId() == ContextMessages::REQ_ATTACH_CTX) res = this->attachContext(msg); else if (msg.getId() == ContextMessages::REQ_DESTROY_CTX) res = this->destroyContext(msg); else LOG_ERROR("Unprocessed message: " + msg.getId()) DEBUG("Response IPC object: " + res.dataStr()); return res; }
//============================================================================= // METHOD: SPELLclientNotifier::processMessageFromExecutor //============================================================================= void SPELLclientNotifier::processMessageFromExecutor( SPELLipcMessage msg ) { if (!m_working) return; DEBUG("[NOTIF] Forward message to client " + ISTR(m_client->getClientKey()) + ": " + msg.dataStr()); m_client->sendMessageToClient(msg); }