Skip to content

Commit 65e147a

Browse files
committed
with extn control for each service
1 parent 7ac9a59 commit 65e147a

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
22

3+
set(CMAKE_BUILD_TYPE "Release")
34
if (NOT CMAKE_BUILD_TYPE)
45
set(CMAKE_BUILD_TYPE "Debug")
5-
#set(CMAKE_BUILD_TYPE "Release")
66
endif()
77
message("-- Build type: ${CMAKE_BUILD_TYPE}")
88

include/zqrpc/RpcServer.hh

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public:
6464
protected:
6565

6666
zmq::context_t* context_;
67+
const char* suffix_;
6768
const std::string use_inproc_workil;
6869
const std::string use_inproc_worker;
6970
const std::string use_inproc_pcontrol;

src/RpcServer.cc

+9-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040

4141
zqrpc::RpcServer::RpcServer(zmq::context_t* context,const char* suffix) :
4242
context_(context),
43-
use_inproc_workil( std::string(ZQRPC_INPROC_WORKIL)+std::string(suffix) ),
44-
use_inproc_worker( std::string(ZQRPC_INPROC_WORKER)+std::string(suffix) ),
45-
use_inproc_pcontrol( std::string(ZQRPC_INPROC_PCONTROL)+std::string(suffix) ),
43+
suffix_(suffix),
44+
use_inproc_workil( std::string(ZQRPC_INPROC_WORKIL)+std::string(suffix_) ),
45+
use_inproc_worker( std::string(ZQRPC_INPROC_WORKER)+std::string(suffix_) ),
46+
use_inproc_pcontrol( std::string(ZQRPC_INPROC_PCONTROL)+std::string(suffix_) ),
4647
rpc_frontend_(context_,ZMQ_ROUTER,"ROUTER"),
4748
rpc_backend_(context_,ZMQ_DEALER,"DEALER"),
4849
rpc_control_(context_,ZMQ_DEALER,"CONTROL"),
@@ -95,11 +96,15 @@ void zqrpc::RpcServer::Start(std::size_t noof_threads)
9596
rpc_frontend_.bind(it->c_str());
9697
}
9798
rpc_frontend_.bind(use_inproc_workil.c_str());
99+
DLOG(INFO) << "Bound " << use_inproc_workil.c_str() << std::endl;
98100
rpc_backend_.bind(use_inproc_worker.c_str());
101+
DLOG(INFO) << "Bound " << use_inproc_worker.c_str() << std::endl;
99102
rpc_control_.bind(use_inproc_pcontrol.c_str());
103+
DLOG(INFO) << "Bound " << use_inproc_pcontrol.c_str() << std::endl;
104+
100105
started_=true;
101106
for(std::size_t i = 0; i < noof_threads; ++i) {
102-
threads_.push_back( new boost::thread(zqrpc::RpcWorker(context_, rpc_method_map_)) );
107+
threads_.push_back( new boost::thread(zqrpc::RpcWorker(context_, rpc_method_map_,suffix_)) );
103108
}
104109
ProxyStart();
105110
DLOG(INFO) << "Loop Ended " << std::endl;

src/RpcWorker.cc

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ zqrpc::RpcWorker::~RpcWorker() {}
5151
void zqrpc::RpcWorker::operator() ()
5252
{
5353
zqrpc::ZSocket socket(context_,ZMQ_DEALER,boost::lexical_cast<std::string>(boost::this_thread::get_id()));
54+
DLOG(INFO) << "Connecting " << use_inproc_worker.c_str() << std::endl;
5455
socket.connect(use_inproc_worker.c_str());
5556
socket.SetLinger(0);
5657
google::protobuf::Message* request = NULL;
@@ -113,7 +114,9 @@ void zqrpc::RpcWorker::operator() ()
113114
}
114115
delete request;
115116
delete response;
117+
DLOG(INFO) << "Disconnecting " << use_inproc_worker.c_str() << std::endl;
116118
socket.disconnect(use_inproc_worker.c_str());
119+
DLOG(INFO) << "Disconnected " << use_inproc_worker.c_str() << std::endl;
117120
socket.close();
118121
/**
119122
for (RpcMethodMapT::iterator it = rpc_method_map_.begin(); it != rpc_method_map_.end();) {

0 commit comments

Comments
 (0)