diff --git a/src/vmci_connecter.cpp b/src/vmci_connecter.cpp index 2abe6f06..f7c149b8 100644 --- a/src/vmci_connecter.cpp +++ b/src/vmci_connecter.cpp @@ -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 () diff --git a/src/vmci_connecter.hpp b/src/vmci_connecter.hpp index 85bdbf0f..4a5b190c 100644 --- a/src/vmci_connecter.hpp +++ b/src/vmci_connecter.hpp @@ -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. diff --git a/src/vmci_listener.cpp b/src/vmci_listener.cpp index 07aa8a29..e3c1de3f 100644 --- a/src/vmci_listener.cpp +++ b/src/vmci_listener.cpp @@ -45,8 +45,12 @@ #include "socket_base.hpp" #include "vmci.hpp" +#if defined ZMQ_HAVE_WINDOWS +#include "windows.hpp" +#else #include #include +#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 () diff --git a/src/vmci_listener.hpp b/src/vmci_listener.hpp index ca036166..e471279b 100644 --- a/src/vmci_listener.hpp +++ b/src/vmci_listener.hpp @@ -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