diff options
Diffstat (limited to 'src/rpc-server/trex_rpc_req_resp_server.cpp')
-rw-r--r-- | src/rpc-server/trex_rpc_req_resp_server.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rpc-server/trex_rpc_req_resp_server.cpp b/src/rpc-server/trex_rpc_req_resp_server.cpp index 75eec856..e0e7635c 100644 --- a/src/rpc-server/trex_rpc_req_resp_server.cpp +++ b/src/rpc-server/trex_rpc_req_resp_server.cpp @@ -201,23 +201,24 @@ void TrexRpcServerReqRes::process_request_raw(const std::string &request, std::s int index = 0; - /* expcetion safe */ - std::unique_lock<std::mutex> lock(*m_lock); - /* for every command parsed - launch it */ for (auto command : commands) { Json::Value single_response; + /* the command itself should be protected */ + std::unique_lock<std::mutex> lock(*m_lock); command->execute(single_response); + lock.unlock(); + delete command; response_json[index++] = single_response; + /* batch is like getting all the messages one by one - it should not be considered as stuck thread */ + /* need to think if this is a good thing */ + //m_monitor.tickle(); } - /* done with the lock */ - lock.unlock(); - /* write the JSON to string and sever on ZMQ */ if (response.size() == 1) { |