mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-23 00:08:02 +02:00
Problem: socket_base_t::connect_routing_id is protected and only used in router_t and stream_t
Solution: add an intermediary base class routing_socket_base_t, move common functionality there and make connect_routing_id private
This commit is contained in:
@@ -1762,3 +1762,36 @@ void zmq::socket_base_t::stop_monitor (bool send_monitor_stopped_event_)
|
||||
_monitor_events = 0;
|
||||
}
|
||||
}
|
||||
|
||||
zmq::routing_socket_base_t::routing_socket_base_t (class ctx_t *parent_,
|
||||
uint32_t tid_,
|
||||
int sid_) :
|
||||
socket_base_t (parent_, tid_, sid_)
|
||||
{
|
||||
}
|
||||
|
||||
int zmq::routing_socket_base_t::xsetsockopt (int option_,
|
||||
const void *optval_,
|
||||
size_t optvallen_)
|
||||
{
|
||||
switch (option_) {
|
||||
case ZMQ_CONNECT_ROUTING_ID:
|
||||
// TODO why isn't it possible to set an empty connect_routing_id
|
||||
// (which is the default value)
|
||||
if (optval_ && optvallen_) {
|
||||
_connect_routing_id.assign (static_cast<const char *> (optval_),
|
||||
optvallen_);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string zmq::routing_socket_base_t::extract_connect_routing_id ()
|
||||
{
|
||||
std::string res = ZMQ_MOVE (_connect_routing_id);
|
||||
_connect_routing_id.clear ();
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user