summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/trex_rpc_req_resp_server.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-06-20 13:50:27 +0300
committerHanoh Haim <hhaim@cisco.com>2016-06-20 13:50:27 +0300
commite356e9e5b70a5bdfefeaf10a09f45974e3969682 (patch)
treef671a2a994ef930cc12bd5dcf0a1282bfd1a762d /src/rpc-server/trex_rpc_req_resp_server.cpp
parent7b13e5e5a6ec2dd71f551e61b846b481d5c58205 (diff)
parent88486da4a095bd7fa7094d4bd9ab54eeafd24a26 (diff)
Merge minor
Diffstat (limited to 'src/rpc-server/trex_rpc_req_resp_server.cpp')
-rw-r--r--src/rpc-server/trex_rpc_req_resp_server.cpp13
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) {