summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/trex_rpc_server.cpp
diff options
context:
space:
mode:
authorDan Klein <danklein10@gmail.com>2016-01-04 23:31:31 +0200
committerDan Klein <danklein10@gmail.com>2016-01-04 23:31:31 +0200
commit629b54c4c9df9c718d818a004ecf15c2cf6c770a (patch)
tree7dfc3c64c7561032d690ce6188130e80d344054e /src/rpc-server/trex_rpc_server.cpp
parent3757099103ed1bf56f85ccf5bb861a331287cbbb (diff)
parent857bdcf05a920b99e1cf180c700176b04801da00 (diff)
Merge branch 'master' into dan_stateless
Diffstat (limited to 'src/rpc-server/trex_rpc_server.cpp')
-rw-r--r--src/rpc-server/trex_rpc_server.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/rpc-server/trex_rpc_server.cpp b/src/rpc-server/trex_rpc_server.cpp
index a14e6f97..1dfc4494 100644
--- a/src/rpc-server/trex_rpc_server.cpp
+++ b/src/rpc-server/trex_rpc_server.cpp
@@ -63,6 +63,9 @@ void TrexRpcServerInterface::start() {
verbose_msg("Starting RPC Server");
+ /* prepare for run */
+ _prepare();
+
m_thread = new std::thread(&TrexRpcServerInterface::_rpc_thread_cb, this);
if (!m_thread) {
throw TrexRpcException("unable to create RPC thread");
@@ -117,9 +120,18 @@ TrexRpcServer::TrexRpcServer(const TrexRpcServerConfig *req_resp_cfg,
const TrexRpcServerConfig *async_cfg,
std::mutex *lock) {
+ m_req_resp = NULL;
+
/* add the request response server */
if (req_resp_cfg) {
- m_servers.push_back(new TrexRpcServerReqRes(*req_resp_cfg, lock));
+
+ if (req_resp_cfg->get_protocol() == TrexRpcServerConfig::RPC_PROT_MOCK) {
+ m_req_resp = new TrexRpcServerReqResMock(*req_resp_cfg);
+ } else {
+ m_req_resp = new TrexRpcServerReqRes(*req_resp_cfg, lock);
+ }
+
+ m_servers.push_back(m_req_resp);
}
/* add async publisher */
@@ -166,3 +178,12 @@ void TrexRpcServer::set_verbose(bool verbose) {
}
}
+
+std::string
+TrexRpcServer::test_inject_request(const std::string &req_str) {
+ if (m_req_resp) {
+ return m_req_resp->test_inject_request(req_str);
+ } else {
+ return "";
+ }
+}