mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-06 00:31:13 +01:00
Problem: redundant code in different preprocessor branches
Solution: change preprocessor guard scope
This commit is contained in:
parent
fc6ef0ebff
commit
d451a95234
@ -465,39 +465,25 @@ void zmq::udp_engine_t::restart_output ()
|
|||||||
void zmq::udp_engine_t::in_event ()
|
void zmq::udp_engine_t::in_event ()
|
||||||
{
|
{
|
||||||
sockaddr_storage in_address;
|
sockaddr_storage in_address;
|
||||||
socklen_t in_addrlen = sizeof (sockaddr_storage);
|
zmq_socklen_t in_addrlen =
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
static_cast<zmq_socklen_t> (sizeof (sockaddr_storage));
|
||||||
int nbytes =
|
|
||||||
|
const int nbytes =
|
||||||
recvfrom (_fd, _in_buffer, MAX_UDP_MSG, 0,
|
recvfrom (_fd, _in_buffer, MAX_UDP_MSG, 0,
|
||||||
reinterpret_cast<sockaddr *> (&in_address), &in_addrlen);
|
reinterpret_cast<sockaddr *> (&in_address), &in_addrlen);
|
||||||
const int last_error = WSAGetLastError ();
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
if (nbytes == SOCKET_ERROR) {
|
if (nbytes == SOCKET_ERROR) {
|
||||||
|
const int last_error = WSAGetLastError ();
|
||||||
wsa_assert (last_error == WSAENETDOWN || last_error == WSAENETRESET
|
wsa_assert (last_error == WSAENETDOWN || last_error == WSAENETRESET
|
||||||
|| last_error == WSAEWOULDBLOCK);
|
|| last_error == WSAEWOULDBLOCK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#elif defined ZMQ_HAVE_VXWORKS
|
#else
|
||||||
int nbytes = recvfrom (_fd, _in_buffer, MAX_UDP_MSG, 0,
|
|
||||||
(sockaddr *) &in_address, (int *) &in_addrlen);
|
|
||||||
if (nbytes == -1) {
|
if (nbytes == -1) {
|
||||||
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
||||||
&& errno != ENOTSOCK);
|
&& errno != ENOTSOCK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int nbytes =
|
|
||||||
recvfrom (_fd, _in_buffer, MAX_UDP_MSG, 0,
|
|
||||||
reinterpret_cast<sockaddr *> (&in_address), &in_addrlen);
|
|
||||||
if (nbytes == -1) {
|
|
||||||
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
|
||||||
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
|
||||||
&& errno != ENOTSOCK);
|
|
||||||
#else
|
|
||||||
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
|
||||||
&& errno != ENOTSOCK);
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
int rc;
|
int rc;
|
||||||
int body_size;
|
int body_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user