mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-14 15:05:38 +02:00
Problem: literals protocol names used at various places
Solution: introduced named constants
This commit is contained in:

committed by
Simon Giesecke

parent
bd76926f5b
commit
0179b7577a
@@ -56,33 +56,33 @@ zmq::address_t::address_t (const std::string &protocol_,
|
|||||||
|
|
||||||
zmq::address_t::~address_t ()
|
zmq::address_t::~address_t ()
|
||||||
{
|
{
|
||||||
if (protocol == "tcp") {
|
if (protocol == protocol_name::tcp) {
|
||||||
if (resolved.tcp_addr) {
|
if (resolved.tcp_addr) {
|
||||||
LIBZMQ_DELETE (resolved.tcp_addr);
|
LIBZMQ_DELETE (resolved.tcp_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (protocol == "udp") {
|
if (protocol == protocol_name::udp) {
|
||||||
if (resolved.udp_addr) {
|
if (resolved.udp_addr) {
|
||||||
LIBZMQ_DELETE (resolved.udp_addr);
|
LIBZMQ_DELETE (resolved.udp_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
&& !defined ZMQ_HAVE_VXWORKS
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
else if (protocol == "ipc") {
|
else if (protocol == protocol_name::ipc) {
|
||||||
if (resolved.ipc_addr) {
|
if (resolved.ipc_addr) {
|
||||||
LIBZMQ_DELETE (resolved.ipc_addr);
|
LIBZMQ_DELETE (resolved.ipc_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_TIPC
|
#if defined ZMQ_HAVE_TIPC
|
||||||
else if (protocol == "tipc") {
|
else if (protocol == protocol_name::tipc) {
|
||||||
if (resolved.tipc_addr) {
|
if (resolved.tipc_addr) {
|
||||||
LIBZMQ_DELETE (resolved.tipc_addr);
|
LIBZMQ_DELETE (resolved.tipc_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
else if (protocol == "vmci") {
|
else if (protocol == protocol_name::vmci) {
|
||||||
if (resolved.vmci_addr) {
|
if (resolved.vmci_addr) {
|
||||||
LIBZMQ_DELETE (resolved.vmci_addr);
|
LIBZMQ_DELETE (resolved.vmci_addr);
|
||||||
}
|
}
|
||||||
@@ -92,29 +92,29 @@ zmq::address_t::~address_t ()
|
|||||||
|
|
||||||
int zmq::address_t::to_string (std::string &addr_) const
|
int zmq::address_t::to_string (std::string &addr_) const
|
||||||
{
|
{
|
||||||
if (protocol == "tcp") {
|
if (protocol == protocol_name::tcp) {
|
||||||
if (resolved.tcp_addr)
|
if (resolved.tcp_addr)
|
||||||
return resolved.tcp_addr->to_string (addr_);
|
return resolved.tcp_addr->to_string (addr_);
|
||||||
}
|
}
|
||||||
if (protocol == "udp") {
|
if (protocol == protocol_name::udp) {
|
||||||
if (resolved.udp_addr)
|
if (resolved.udp_addr)
|
||||||
return resolved.udp_addr->to_string (addr_);
|
return resolved.udp_addr->to_string (addr_);
|
||||||
}
|
}
|
||||||
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
&& !defined ZMQ_HAVE_VXWORKS
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
else if (protocol == "ipc") {
|
else if (protocol == protocol_name::ipc) {
|
||||||
if (resolved.ipc_addr)
|
if (resolved.ipc_addr)
|
||||||
return resolved.ipc_addr->to_string (addr_);
|
return resolved.ipc_addr->to_string (addr_);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_TIPC
|
#if defined ZMQ_HAVE_TIPC
|
||||||
else if (protocol == "tipc") {
|
else if (protocol == protocol_name::tipc) {
|
||||||
if (resolved.tipc_addr)
|
if (resolved.tipc_addr)
|
||||||
return resolved.tipc_addr->to_string (addr_);
|
return resolved.tipc_addr->to_string (addr_);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
else if (protocol == "vmci") {
|
else if (protocol == protocol_name::vmci) {
|
||||||
if (resolved.vmci_addr)
|
if (resolved.vmci_addr)
|
||||||
return resolved.vmci_addr->to_string (addr_);
|
return resolved.vmci_addr->to_string (addr_);
|
||||||
}
|
}
|
||||||
|
@@ -46,6 +46,23 @@ class tipc_address_t;
|
|||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
class vmci_address_t;
|
class vmci_address_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace protocol_name
|
||||||
|
{
|
||||||
|
static const char tcp[] = "tcp";
|
||||||
|
static const char udp[] = "udp";
|
||||||
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
|
static const char ipc[] = "ipc";
|
||||||
|
#endif
|
||||||
|
#if defined ZMQ_HAVE_TIPC
|
||||||
|
static const char tipc[] = "tipc";
|
||||||
|
#endif
|
||||||
|
#if defined ZMQ_HAVE_VMCI
|
||||||
|
static const char vmci[] = "vmci";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
struct address_t
|
struct address_t
|
||||||
{
|
{
|
||||||
address_t (const std::string &protocol_,
|
address_t (const std::string &protocol_,
|
||||||
|
@@ -67,7 +67,7 @@ zmq::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
|
|||||||
current_reconnect_ivl (options.reconnect_ivl)
|
current_reconnect_ivl (options.reconnect_ivl)
|
||||||
{
|
{
|
||||||
zmq_assert (addr);
|
zmq_assert (addr);
|
||||||
zmq_assert (addr->protocol == "ipc");
|
zmq_assert (addr->protocol == protocol_name::ipc);
|
||||||
addr->to_string (endpoint);
|
addr->to_string (endpoint);
|
||||||
socket = session->get_socket ();
|
socket = session->get_socket ();
|
||||||
}
|
}
|
||||||
|
@@ -515,7 +515,7 @@ void zmq::session_base_t::reconnect ()
|
|||||||
// and reestablish later on
|
// and reestablish later on
|
||||||
if (_pipe && options.immediate == 1 && _addr->protocol != "pgm"
|
if (_pipe && options.immediate == 1 && _addr->protocol != "pgm"
|
||||||
&& _addr->protocol != "epgm" && _addr->protocol != "norm"
|
&& _addr->protocol != "epgm" && _addr->protocol != "norm"
|
||||||
&& _addr->protocol != "udp") {
|
&& _addr->protocol != protocol_name::udp) {
|
||||||
_pipe->hiccup ();
|
_pipe->hiccup ();
|
||||||
_pipe->terminate (false);
|
_pipe->terminate (false);
|
||||||
_terminating_pipes.insert (_pipe);
|
_terminating_pipes.insert (_pipe);
|
||||||
@@ -557,10 +557,11 @@ void zmq::session_base_t::start_connecting (bool wait_)
|
|||||||
|
|
||||||
// Create the connecter object.
|
// Create the connecter object.
|
||||||
|
|
||||||
if (_addr->protocol == "tcp") {
|
if (_addr->protocol == protocol_name::tcp) {
|
||||||
if (!options.socks_proxy_address.empty ()) {
|
if (!options.socks_proxy_address.empty ()) {
|
||||||
address_t *proxy_address = new (std::nothrow)
|
address_t *proxy_address = new (std::nothrow)
|
||||||
address_t ("tcp", options.socks_proxy_address, this->get_ctx ());
|
address_t (protocol_name::tcp, options.socks_proxy_address,
|
||||||
|
this->get_ctx ());
|
||||||
alloc_assert (proxy_address);
|
alloc_assert (proxy_address);
|
||||||
socks_connecter_t *connecter = new (std::nothrow)
|
socks_connecter_t *connecter = new (std::nothrow)
|
||||||
socks_connecter_t (io_thread, this, options, _addr, proxy_address,
|
socks_connecter_t (io_thread, this, options, _addr, proxy_address,
|
||||||
@@ -578,7 +579,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
|
|||||||
|
|
||||||
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
&& !defined ZMQ_HAVE_VXWORKS
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
if (_addr->protocol == "ipc") {
|
if (_addr->protocol == protocol_name::ipc) {
|
||||||
ipc_connecter_t *connecter = new (std::nothrow)
|
ipc_connecter_t *connecter = new (std::nothrow)
|
||||||
ipc_connecter_t (io_thread, this, options, _addr, wait_);
|
ipc_connecter_t (io_thread, this, options, _addr, wait_);
|
||||||
alloc_assert (connecter);
|
alloc_assert (connecter);
|
||||||
@@ -587,7 +588,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_TIPC
|
#if defined ZMQ_HAVE_TIPC
|
||||||
if (_addr->protocol == "tipc") {
|
if (_addr->protocol == protocol_name::tipc) {
|
||||||
tipc_connecter_t *connecter = new (std::nothrow)
|
tipc_connecter_t *connecter = new (std::nothrow)
|
||||||
tipc_connecter_t (io_thread, this, options, _addr, wait_);
|
tipc_connecter_t (io_thread, this, options, _addr, wait_);
|
||||||
alloc_assert (connecter);
|
alloc_assert (connecter);
|
||||||
@@ -596,7 +597,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_addr->protocol == "udp") {
|
if (_addr->protocol == protocol_name::udp) {
|
||||||
zmq_assert (options.type == ZMQ_DISH || options.type == ZMQ_RADIO
|
zmq_assert (options.type == ZMQ_DISH || options.type == ZMQ_RADIO
|
||||||
|| options.type == ZMQ_DGRAM);
|
|| options.type == ZMQ_DGRAM);
|
||||||
|
|
||||||
@@ -698,7 +699,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
|
|||||||
#endif // ZMQ_HAVE_NORM
|
#endif // ZMQ_HAVE_NORM
|
||||||
|
|
||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
if (_addr->protocol == "vmci") {
|
if (_addr->protocol == protocol_name::vmci) {
|
||||||
vmci_connecter_t *connecter = new (std::nothrow)
|
vmci_connecter_t *connecter = new (std::nothrow)
|
||||||
vmci_connecter_t (io_thread, this, options, _addr, wait_);
|
vmci_connecter_t (io_thread, this, options, _addr, wait_);
|
||||||
alloc_assert (connecter);
|
alloc_assert (connecter);
|
||||||
|
@@ -295,9 +295,9 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
|
|||||||
if (protocol_ != "inproc"
|
if (protocol_ != "inproc"
|
||||||
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
&& !defined ZMQ_HAVE_VXWORKS
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
&& protocol_ != "ipc"
|
&& protocol_ != protocol_name::ipc
|
||||||
#endif
|
#endif
|
||||||
&& protocol_ != "tcp"
|
&& protocol_ != protocol_name::tcp
|
||||||
#if defined ZMQ_HAVE_OPENPGM
|
#if defined ZMQ_HAVE_OPENPGM
|
||||||
// pgm/epgm transports only available if 0MQ is compiled with OpenPGM.
|
// pgm/epgm transports only available if 0MQ is compiled with OpenPGM.
|
||||||
&& protocol_ != "pgm"
|
&& protocol_ != "pgm"
|
||||||
@@ -305,15 +305,15 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
|
|||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_TIPC
|
#if defined ZMQ_HAVE_TIPC
|
||||||
// TIPC transport is only available on Linux.
|
// TIPC transport is only available on Linux.
|
||||||
&& protocol_ != "tipc"
|
&& protocol_ != protocol_name::tipc
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_NORM
|
#if defined ZMQ_HAVE_NORM
|
||||||
&& protocol_ != "norm"
|
&& protocol_ != "norm"
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
&& protocol_ != "vmci"
|
&& protocol_ != protocol_name::vmci
|
||||||
#endif
|
#endif
|
||||||
&& protocol_ != "udp") {
|
&& protocol_ != protocol_name::udp) {
|
||||||
errno = EPROTONOSUPPORT;
|
errno = EPROTONOSUPPORT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (protocol_ == "udp"
|
if (protocol_ == protocol_name::udp
|
||||||
&& (options.type != ZMQ_DISH && options.type != ZMQ_RADIO
|
&& (options.type != ZMQ_DISH && options.type != ZMQ_RADIO
|
||||||
&& options.type != ZMQ_DGRAM)) {
|
&& options.type != ZMQ_DGRAM)) {
|
||||||
errno = ENOCOMPATPROTO;
|
errno = ENOCOMPATPROTO;
|
||||||
@@ -511,7 +511,7 @@ int zmq::socket_base_t::bind (const char *addr_)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protocol == "udp") {
|
if (protocol == protocol_name::udp) {
|
||||||
if (!(options.type == ZMQ_DGRAM || options.type == ZMQ_DISH)) {
|
if (!(options.type == ZMQ_DGRAM || options.type == ZMQ_DISH)) {
|
||||||
errno = ENOCOMPATPROTO;
|
errno = ENOCOMPATPROTO;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -575,7 +575,7 @@ int zmq::socket_base_t::bind (const char *addr_)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protocol == "tcp") {
|
if (protocol == protocol_name::tcp) {
|
||||||
tcp_listener_t *listener =
|
tcp_listener_t *listener =
|
||||||
new (std::nothrow) tcp_listener_t (io_thread, this, options);
|
new (std::nothrow) tcp_listener_t (io_thread, this, options);
|
||||||
alloc_assert (listener);
|
alloc_assert (listener);
|
||||||
@@ -596,7 +596,7 @@ int zmq::socket_base_t::bind (const char *addr_)
|
|||||||
|
|
||||||
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
&& !defined ZMQ_HAVE_VXWORKS
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
if (protocol == "ipc") {
|
if (protocol == protocol_name::ipc) {
|
||||||
ipc_listener_t *listener =
|
ipc_listener_t *listener =
|
||||||
new (std::nothrow) ipc_listener_t (io_thread, this, options);
|
new (std::nothrow) ipc_listener_t (io_thread, this, options);
|
||||||
alloc_assert (listener);
|
alloc_assert (listener);
|
||||||
@@ -616,7 +616,7 @@ int zmq::socket_base_t::bind (const char *addr_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_TIPC
|
#if defined ZMQ_HAVE_TIPC
|
||||||
if (protocol == "tipc") {
|
if (protocol == protocol_name::tipc) {
|
||||||
tipc_listener_t *listener =
|
tipc_listener_t *listener =
|
||||||
new (std::nothrow) tipc_listener_t (io_thread, this, options);
|
new (std::nothrow) tipc_listener_t (io_thread, this, options);
|
||||||
alloc_assert (listener);
|
alloc_assert (listener);
|
||||||
@@ -636,7 +636,7 @@ int zmq::socket_base_t::bind (const char *addr_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
if (protocol == "vmci") {
|
if (protocol == protocol_name::vmci) {
|
||||||
vmci_listener_t *listener =
|
vmci_listener_t *listener =
|
||||||
new (std::nothrow) vmci_listener_t (io_thread, this, options);
|
new (std::nothrow) vmci_listener_t (io_thread, this, options);
|
||||||
alloc_assert (listener);
|
alloc_assert (listener);
|
||||||
@@ -809,7 +809,7 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
alloc_assert (paddr);
|
alloc_assert (paddr);
|
||||||
|
|
||||||
// Resolve address (if needed by the protocol)
|
// Resolve address (if needed by the protocol)
|
||||||
if (protocol == "tcp") {
|
if (protocol == protocol_name::tcp) {
|
||||||
// Do some basic sanity checks on tcp:// address syntax
|
// Do some basic sanity checks on tcp:// address syntax
|
||||||
// - hostname starts with digit or letter, with embedded '-' or '.'
|
// - hostname starts with digit or letter, with embedded '-' or '.'
|
||||||
// - IPv6 address may contain hex chars and colons.
|
// - IPv6 address may contain hex chars and colons.
|
||||||
@@ -853,7 +853,7 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
}
|
}
|
||||||
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS \
|
||||||
&& !defined ZMQ_HAVE_VXWORKS
|
&& !defined ZMQ_HAVE_VXWORKS
|
||||||
else if (protocol == "ipc") {
|
else if (protocol == protocol_name::ipc) {
|
||||||
paddr->resolved.ipc_addr = new (std::nothrow) ipc_address_t ();
|
paddr->resolved.ipc_addr = new (std::nothrow) ipc_address_t ();
|
||||||
alloc_assert (paddr->resolved.ipc_addr);
|
alloc_assert (paddr->resolved.ipc_addr);
|
||||||
int rc = paddr->resolved.ipc_addr->resolve (address.c_str ());
|
int rc = paddr->resolved.ipc_addr->resolve (address.c_str ());
|
||||||
@@ -864,7 +864,7 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (protocol == "udp") {
|
if (protocol == protocol_name::udp) {
|
||||||
if (options.type != ZMQ_RADIO) {
|
if (options.type != ZMQ_RADIO) {
|
||||||
errno = ENOCOMPATPROTO;
|
errno = ENOCOMPATPROTO;
|
||||||
LIBZMQ_DELETE (paddr);
|
LIBZMQ_DELETE (paddr);
|
||||||
@@ -897,7 +897,7 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_TIPC
|
#if defined ZMQ_HAVE_TIPC
|
||||||
else if (protocol == "tipc") {
|
else if (protocol == protocol_name::tipc) {
|
||||||
paddr->resolved.tipc_addr = new (std::nothrow) tipc_address_t ();
|
paddr->resolved.tipc_addr = new (std::nothrow) tipc_address_t ();
|
||||||
alloc_assert (paddr->resolved.tipc_addr);
|
alloc_assert (paddr->resolved.tipc_addr);
|
||||||
int rc = paddr->resolved.tipc_addr->resolve (address.c_str ());
|
int rc = paddr->resolved.tipc_addr->resolve (address.c_str ());
|
||||||
@@ -917,7 +917,7 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined ZMQ_HAVE_VMCI
|
#if defined ZMQ_HAVE_VMCI
|
||||||
else if (protocol == "vmci") {
|
else if (protocol == protocol_name::vmci) {
|
||||||
paddr->resolved.vmci_addr =
|
paddr->resolved.vmci_addr =
|
||||||
new (std::nothrow) vmci_address_t (this->get_ctx ());
|
new (std::nothrow) vmci_address_t (this->get_ctx ());
|
||||||
alloc_assert (paddr->resolved.vmci_addr);
|
alloc_assert (paddr->resolved.vmci_addr);
|
||||||
@@ -937,7 +937,8 @@ int zmq::socket_base_t::connect (const char *addr_)
|
|||||||
// PGM does not support subscription forwarding; ask for all data to be
|
// PGM does not support subscription forwarding; ask for all data to be
|
||||||
// sent to this pipe. (same for NORM, currently?)
|
// sent to this pipe. (same for NORM, currently?)
|
||||||
bool subscribe_to_all = protocol == "pgm" || protocol == "epgm"
|
bool subscribe_to_all = protocol == "pgm" || protocol == "epgm"
|
||||||
|| protocol == "norm" || protocol == "udp";
|
|| protocol == "norm"
|
||||||
|
|| protocol == protocol_name::udp;
|
||||||
pipe_t *newpipe = NULL;
|
pipe_t *newpipe = NULL;
|
||||||
|
|
||||||
if (options.immediate != 1 || subscribe_to_all) {
|
if (options.immediate != 1 || subscribe_to_all) {
|
||||||
@@ -1039,7 +1040,7 @@ int zmq::socket_base_t::term_endpoint (const char *addr_)
|
|||||||
// IPv4-in-IPv6 mapping (EG: tcp://[::ffff:127.0.0.1]:9999), so try to
|
// IPv4-in-IPv6 mapping (EG: tcp://[::ffff:127.0.0.1]:9999), so try to
|
||||||
// resolve before giving up. Given at this stage we don't know whether a
|
// resolve before giving up. Given at this stage we don't know whether a
|
||||||
// socket is connected or bound, try with both.
|
// socket is connected or bound, try with both.
|
||||||
if (protocol == "tcp") {
|
if (protocol == protocol_name::tcp) {
|
||||||
if (_endpoints.find (resolved_addr) == _endpoints.end ()) {
|
if (_endpoints.find (resolved_addr) == _endpoints.end ()) {
|
||||||
tcp_address_t *tcp_addr = new (std::nothrow) tcp_address_t ();
|
tcp_address_t *tcp_addr = new (std::nothrow) tcp_address_t ();
|
||||||
alloc_assert (tcp_addr);
|
alloc_assert (tcp_addr);
|
||||||
|
@@ -72,7 +72,7 @@ zmq::socks_connecter_t::socks_connecter_t (class io_thread_t *io_thread_,
|
|||||||
_current_reconnect_ivl (options.reconnect_ivl)
|
_current_reconnect_ivl (options.reconnect_ivl)
|
||||||
{
|
{
|
||||||
zmq_assert (_addr);
|
zmq_assert (_addr);
|
||||||
zmq_assert (_addr->protocol == "tcp");
|
zmq_assert (_addr->protocol == protocol_name::tcp);
|
||||||
_proxy_addr->to_string (_endpoint);
|
_proxy_addr->to_string (_endpoint);
|
||||||
_socket = _session->get_socket ();
|
_socket = _session->get_socket ();
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
|
|||||||
_socket (_session->get_socket ())
|
_socket (_session->get_socket ())
|
||||||
{
|
{
|
||||||
zmq_assert (_addr);
|
zmq_assert (_addr);
|
||||||
zmq_assert (_addr->protocol == "tcp");
|
zmq_assert (_addr->protocol == protocol_name::tcp);
|
||||||
_addr->to_string (_endpoint);
|
_addr->to_string (_endpoint);
|
||||||
// TODO the return value is unused! what if it fails? if this is impossible
|
// TODO the return value is unused! what if it fails? if this is impossible
|
||||||
// or does not matter, change such that endpoint in initialized using an
|
// or does not matter, change such that endpoint in initialized using an
|
||||||
|
@@ -87,10 +87,10 @@ struct iovec
|
|||||||
#include "msg.hpp"
|
#include "msg.hpp"
|
||||||
#include "fd.hpp"
|
#include "fd.hpp"
|
||||||
#include "metadata.hpp"
|
#include "metadata.hpp"
|
||||||
#include "signaler.hpp"
|
|
||||||
#include "socket_poller.hpp"
|
#include "socket_poller.hpp"
|
||||||
#include "timers.hpp"
|
#include "timers.hpp"
|
||||||
#include "ip.hpp"
|
#include "ip.hpp"
|
||||||
|
#include "address.hpp"
|
||||||
|
|
||||||
#if defined ZMQ_HAVE_OPENPGM
|
#if defined ZMQ_HAVE_OPENPGM
|
||||||
#define __PGM_WININT_H__
|
#define __PGM_WININT_H__
|
||||||
@@ -1489,7 +1489,7 @@ int zmq_device (int /* type */, void *frontend_, void *backend_)
|
|||||||
int zmq_has (const char *capability_)
|
int zmq_has (const char *capability_)
|
||||||
{
|
{
|
||||||
#if !defined(ZMQ_HAVE_WINDOWS) && !defined(ZMQ_HAVE_OPENVMS)
|
#if !defined(ZMQ_HAVE_WINDOWS) && !defined(ZMQ_HAVE_OPENVMS)
|
||||||
if (strcmp (capability_, "ipc") == 0)
|
if (strcmp (capability_, zmq::protocol_name::ipc) == 0)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ZMQ_HAVE_OPENPGM)
|
#if defined(ZMQ_HAVE_OPENPGM)
|
||||||
@@ -1497,7 +1497,7 @@ int zmq_has (const char *capability_)
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ZMQ_HAVE_TIPC)
|
#if defined(ZMQ_HAVE_TIPC)
|
||||||
if (strcmp (capability_, "tipc") == 0)
|
if (strcmp (capability_, zmq::protocol_name::tipc) == 0)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ZMQ_HAVE_NORM)
|
#if defined(ZMQ_HAVE_NORM)
|
||||||
@@ -1513,7 +1513,7 @@ int zmq_has (const char *capability_)
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ZMQ_HAVE_VMCI)
|
#if defined(ZMQ_HAVE_VMCI)
|
||||||
if (strcmp (capability_, "vmci") == 0)
|
if (strcmp (capability_, zmq::protocol_name::vmci) == 0)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ZMQ_BUILD_DRAFT_API)
|
#if defined(ZMQ_BUILD_DRAFT_API)
|
||||||
|
Reference in New Issue
Block a user