diff options
author | Martin Sustrik <sustrik@fastmq.com> | 2009-09-22 08:30:15 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@fastmq.com> | 2009-09-22 08:30:15 +0200 |
commit | e6ca5da1815023e90306914dab101eeef4b6f199 (patch) | |
tree | 3a584015c3a2b4bfe09d8f3ace9d945f510d9951 /src | |
parent | b15f695976d21300beabc3e0ecef87c1a0b4dc4c (diff) |
Windows build fixed
Diffstat (limited to 'src')
-rw-r--r-- | src/fd_signaler.cpp | 31 | ||||
-rw-r--r-- | src/p2p.cpp | 3 | ||||
-rw-r--r-- | src/rep.cpp | 2 |
3 files changed, 21 insertions, 15 deletions
diff --git a/src/fd_signaler.cpp b/src/fd_signaler.cpp index b67b27b..293123d 100644 --- a/src/fd_signaler.cpp +++ b/src/fd_signaler.cpp @@ -70,6 +70,7 @@ uint64_t zmq::fd_signaler_t::poll () // TODO: Can we do a blocking read on non-blocking eventfd? // It's not needed as for now, so let it stay unimplemented. zmq_assert (false); + return 0; } uint64_t zmq::fd_signaler_t::check () @@ -129,7 +130,13 @@ zmq::fd_signaler_t::fd_signaler_t () // Accept connection from w. r = accept (listener, NULL, NULL); wsa_assert (r != INVALID_SOCKET); - + + // Set the read site of the pair to non-blocking mode. + //unsigned long argp = 1; + //rc = ioctlsocket (r, FIONBIO, &argp); + //wsa_assert (rc != SOCKET_ERROR); + + // We don't need the listening socket anymore. Close it. rc = closesocket (listener); wsa_assert (rc != SOCKET_ERROR); } @@ -156,25 +163,19 @@ void zmq::fd_signaler_t::signal (int signal_) uint64_t zmq::fd_signaler_t::poll () { - // If there are signals available, return straight away. - uint64_t signals = check (); - if (signals) - return signals; - - // If there are no signals, wait until at least one signal arrives. - unsigned char sig; - int nbytes = recv (r, (char*) &sig, 1, 0); - win_assert (nbytes != -1); - return uint64_t (1) << sig; + // TODO: Can we do a blocking read on non-blocking socket? + // It's not needed as for now, so let it stay unimplemented. + zmq_assert (false); + return 0; } uint64_t zmq::fd_signaler_t::check () { - unsigned char buffer [32]; - int nbytes = recv (r, (char*) buffer, 32, MSG_DONTWAIT); - if (nbytes == -1 && errno == EAGAIN) + unsigned char buffer [32]; + int nbytes = recv (r, (char*) buffer, 32, 0); + if (nbytes == -1 && WSAGetLastError () == WSAEWOULDBLOCK) return 0; - win_assert (nbytes != -1); + wsa_assert (nbytes != -1); uint64_t signals = 0; for (int pos = 0; pos != nbytes; pos++) { diff --git a/src/p2p.cpp b/src/p2p.cpp index 8ef27a7..f403041 100644 --- a/src/p2p.cpp +++ b/src/p2p.cpp @@ -69,16 +69,19 @@ int zmq::p2p_t::xsetsockopt (int option_, const void *optval_, int zmq::p2p_t::xsend (struct zmq_msg_t *msg_, int flags_) { zmq_assert (false); + return 0; } int zmq::p2p_t::xflush () { zmq_assert (false); + return 0; } int zmq::p2p_t::xrecv (struct zmq_msg_t *msg_, int flags_) { zmq_assert (false); + return 0; } diff --git a/src/rep.cpp b/src/rep.cpp index d586988..fcf8058 100644 --- a/src/rep.cpp +++ b/src/rep.cpp @@ -155,6 +155,8 @@ int zmq::rep_t::xsend (struct zmq_msg_t *msg_, int flags_) // Detach the message from the data buffer. int rc = zmq_msg_init (msg_); zmq_assert (rc == 0); + + return 0; } int zmq::rep_t::xflush () |