0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-15 18:38:00 +08:00

Set errno and update documentation on zmq_disconnect

This commit is contained in:
Stefan Radomski 2012-12-04 13:52:23 +01:00
parent 2388f27bfe
commit b0563c2103
2 changed files with 8 additions and 2 deletions

View File

@ -34,6 +34,8 @@ The endpoint supplied is invalid.
The 0MQ 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*ENOTCONN*::
The provided endpoint is not connected.
EXAMPLE

View File

@ -602,8 +602,10 @@ int zmq::socket_base_t::term_endpoint (const char *addr_)
// Disconnect an inproc socket
if (protocol == "inproc") {
std::pair <inprocs_t::iterator, inprocs_t::iterator> range = inprocs.equal_range (std::string (addr_));
if (range.first == range.second)
if (range.first == range.second) {
errno = ENOTCONN;
return -1;
}
for (inprocs_t::iterator it = range.first; it != range.second; ++it)
it->second->terminate(true);
@ -614,8 +616,10 @@ int zmq::socket_base_t::term_endpoint (const char *addr_)
// Find the endpoints range (if any) corresponding to the addr_ string.
std::pair <endpoints_t::iterator, endpoints_t::iterator> range = endpoints.equal_range (std::string (addr_));
if (range.first == range.second)
if (range.first == range.second) {
errno = ENOTCONN;
return -1;
}
for (endpoints_t::iterator it = range.first; it != range.second; ++it)
term_child (it->second);