mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-29 08:39:42 +08:00
Merge pull request #1725 from GreatFruitOmsk/master
This commit is contained in:
commit
511d701de3
@ -41,8 +41,8 @@
|
||||
#include "err.hpp"
|
||||
#include "ip.hpp"
|
||||
#include "address.hpp"
|
||||
#include "ipc_address.hpp"
|
||||
#include "session_base.hpp"
|
||||
#include "vmci_address.hpp"
|
||||
#include "vmci.hpp"
|
||||
|
||||
zmq::vmci_connecter_t::vmci_connecter_t (class io_thread_t *io_thread_,
|
||||
@ -226,8 +226,8 @@ int zmq::vmci_connecter_t::open ()
|
||||
|
||||
// Connect to the remote peer.
|
||||
int rc = ::connect (
|
||||
s, addr->resolved.ipc_addr->addr (),
|
||||
addr->resolved.ipc_addr->addrlen ());
|
||||
s, addr->resolved.vmci_addr->addr (),
|
||||
addr->resolved.vmci_addr->addrlen ());
|
||||
|
||||
// Connect was successful immediately.
|
||||
if (rc == 0)
|
||||
@ -244,14 +244,18 @@ int zmq::vmci_connecter_t::open ()
|
||||
return -1;
|
||||
}
|
||||
|
||||
int zmq::vmci_connecter_t::close ()
|
||||
void zmq::vmci_connecter_t::close ()
|
||||
{
|
||||
zmq_assert (s != retired_fd);
|
||||
int rc = ::close (s);
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
const int rc = closesocket (s);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
#else
|
||||
const int rc = ::close (s);
|
||||
errno_assert (rc == 0);
|
||||
#endif
|
||||
socket->event_closed (endpoint, s);
|
||||
s = retired_fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
zmq::fd_t zmq::vmci_connecter_t::connect ()
|
||||
|
@ -88,7 +88,7 @@ namespace zmq
|
||||
int open ();
|
||||
|
||||
// Close the connecting socket.
|
||||
int close ();
|
||||
void close ();
|
||||
|
||||
// Get the file descriptor of newly created connection. Returns
|
||||
// retired_fd if the connection was unsuccessful.
|
||||
|
@ -45,8 +45,12 @@
|
||||
#include "socket_base.hpp"
|
||||
#include "vmci.hpp"
|
||||
|
||||
#if defined ZMQ_HAVE_WINDOWS
|
||||
#include "windows.hpp"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
zmq::vmci_listener_t::vmci_listener_t (io_thread_t *io_thread_,
|
||||
socket_base_t *socket_, const options_t &options_) :
|
||||
@ -174,16 +178,18 @@ int zmq::vmci_listener_t::set_address (const char *addr_)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int zmq::vmci_listener_t::close ()
|
||||
void zmq::vmci_listener_t::close ()
|
||||
{
|
||||
zmq_assert (s != retired_fd);
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
int rc = closesocket (s);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
#else
|
||||
int rc = ::close (s);
|
||||
errno_assert (rc == 0);
|
||||
|
||||
s = retired_fd;
|
||||
|
||||
#endif
|
||||
socket->event_closed (endpoint, s);
|
||||
return 0;
|
||||
s = retired_fd;
|
||||
}
|
||||
|
||||
zmq::fd_t zmq::vmci_listener_t::accept ()
|
||||
|
@ -71,7 +71,7 @@ namespace zmq
|
||||
void in_event ();
|
||||
|
||||
// Close the listening socket.
|
||||
int close ();
|
||||
void close ();
|
||||
|
||||
// Accept the new connection. Returns the file descriptor of the
|
||||
// newly created connection. The function may return retired_fd
|
||||
|
Loading…
x
Reference in New Issue
Block a user