Return error on invalid PGM url instead of raising assertion.

Fix Win32 build.
This commit is contained in:
Steven McCoy
2012-05-30 20:52:19 -04:00
parent 32befeb0a6
commit 13976a3d65
4 changed files with 57 additions and 17 deletions

View File

@@ -55,6 +55,9 @@
#include "address.hpp"
#include "ipc_address.hpp"
#include "tcp_address.hpp"
#ifdef ZMQ_HAVE_OPENPGM
#include "pgm_socket.hpp"
#endif
#include "pair.hpp"
#include "pub.hpp"
@@ -510,6 +513,17 @@ int zmq::socket_base_t::connect (const char *addr_)
return -1;
}
}
#endif
#ifdef ZMQ_HAVE_OPENPGM
if (protocol == "pgm" || protocol == "epgm") {
struct pgm_addrinfo_t *res = NULL;
uint16_t port_number = 0;
int rc = pgm_socket_t::init_address(address.c_str(), &res, &port_number);
if (res != NULL)
pgm_freeaddrinfo (res);
if (rc != 0 || port_number == 0)
return -1;
}
#endif
// Create session.
session_base_t *session = session_base_t::create (io_thread, true, this,