mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-06 05:00:07 +01:00
problem: zeromq doesn't has a thread-safe peer to peer socket
Solution: a new socket type, called PEER. Very similar to SERVER, but can only connect to other PEERs. Also a new zmq_connect_peer method, that connect and return a routing-id in thread-safe and atomic operation
This commit is contained in:
@@ -93,6 +93,7 @@ const char socket_type_dish[] = "DISH";
|
||||
const char socket_type_gather[] = "GATHER";
|
||||
const char socket_type_scatter[] = "SCATTER";
|
||||
const char socket_type_dgram[] = "DGRAM";
|
||||
const char socket_type_peer[] = "PEER";
|
||||
#endif
|
||||
|
||||
const char *zmq::mechanism_t::socket_type_string (int socket_type_)
|
||||
@@ -106,7 +107,7 @@ const char *zmq::mechanism_t::socket_type_string (int socket_type_)
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
socket_type_server, socket_type_client, socket_type_radio,
|
||||
socket_type_dish, socket_type_gather, socket_type_scatter,
|
||||
socket_type_dgram
|
||||
socket_type_dgram, socket_type_peer
|
||||
#endif
|
||||
};
|
||||
static const size_t names_count = sizeof (names) / sizeof (names[0]);
|
||||
@@ -353,6 +354,8 @@ bool zmq::mechanism_t::check_socket_type (const char *type_,
|
||||
return strequals (type_, len_, socket_type_gather);
|
||||
case ZMQ_DGRAM:
|
||||
return strequals (type_, len_, socket_type_dgram);
|
||||
case ZMQ_PEER:
|
||||
return strequals (type_, len_, socket_type_peer);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user