mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 16:06:09 +00:00
Allow EBADF on iOS #3046
This commit is contained in:
parent
cbd52feb48
commit
fa027970bb
@ -66,6 +66,10 @@
|
|||||||
#include <pgm/pgm.h>
|
#include <pgm/pgm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
|
zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -167,7 +171,11 @@ int zmq::get_peer_ip_address (fd_t sockfd_, std::string &ip_addr_)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
|
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
||||||
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOTSOCK);
|
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOTSOCK);
|
||||||
|
#else
|
||||||
|
errno_assert (errno != EFAULT && errno != ENOTSOCK);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
15
src/tcp.cpp
15
src/tcp.cpp
@ -48,6 +48,10 @@
|
|||||||
#include <ioctl.h>
|
#include <ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int zmq::tune_tcp_socket (fd_t s_)
|
int zmq::tune_tcp_socket (fd_t s_)
|
||||||
{
|
{
|
||||||
// Disable Nagle's algorithm. We are doing data batching on 0MQ level,
|
// Disable Nagle's algorithm. We are doing data batching on 0MQ level,
|
||||||
@ -238,10 +242,17 @@ int zmq::tcp_write (fd_t s_, const void *data_, size_t size_)
|
|||||||
|
|
||||||
// Signalise peer failure.
|
// Signalise peer failure.
|
||||||
if (nbytes == -1) {
|
if (nbytes == -1) {
|
||||||
|
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
||||||
errno_assert (errno != EACCES && errno != EBADF && errno != EDESTADDRREQ
|
errno_assert (errno != EACCES && errno != EBADF && errno != EDESTADDRREQ
|
||||||
&& errno != EFAULT && errno != EISCONN
|
&& errno != EFAULT && errno != EISCONN
|
||||||
&& errno != EMSGSIZE && errno != ENOMEM
|
&& errno != EMSGSIZE && errno != ENOMEM
|
||||||
&& errno != ENOTSOCK && errno != EOPNOTSUPP);
|
&& errno != ENOTSOCK && errno != EOPNOTSUPP);
|
||||||
|
#else
|
||||||
|
errno_assert (errno != EACCES && errno != EDESTADDRREQ
|
||||||
|
&& errno != EFAULT && errno != EISCONN
|
||||||
|
&& errno != EMSGSIZE && errno != ENOMEM
|
||||||
|
&& errno != ENOTSOCK && errno != EOPNOTSUPP);
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,8 +293,12 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_)
|
|||||||
// be able to read a single byte from the socket. Also, SIGSTOP issued
|
// be able to read a single byte from the socket. Also, SIGSTOP issued
|
||||||
// by a debugging tool can result in EINTR error.
|
// by a debugging tool can result in EINTR error.
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
|
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
||||||
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
||||||
&& errno != ENOTSOCK);
|
&& errno != ENOTSOCK);
|
||||||
|
#else
|
||||||
|
errno_assert (errno != EFAULT && errno != ENOMEM && errno != ENOTSOCK);
|
||||||
|
#endif
|
||||||
if (errno == EWOULDBLOCK || errno == EINTR)
|
if (errno == EWOULDBLOCK || errno == EINTR)
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
|
zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
|
||||||
class session_base_t *session_,
|
class session_base_t *session_,
|
||||||
const options_t &options_,
|
const options_t &options_,
|
||||||
@ -403,8 +407,13 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
|
|||||||
err = errno;
|
err = errno;
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
errno = err;
|
errno = err;
|
||||||
|
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
||||||
errno_assert (errno != EBADF && errno != ENOPROTOOPT
|
errno_assert (errno != EBADF && errno != ENOPROTOOPT
|
||||||
&& errno != ENOTSOCK && errno != ENOBUFS);
|
&& errno != ENOTSOCK && errno != ENOBUFS);
|
||||||
|
#else
|
||||||
|
errno_assert (errno != ENOPROTOOPT && errno != ENOTSOCK
|
||||||
|
&& errno != ENOBUFS);
|
||||||
|
#endif
|
||||||
return retired_fd;
|
return retired_fd;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,6 +51,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
|
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
zmq::udp_engine_t::udp_engine_t (const options_t &options_) :
|
zmq::udp_engine_t::udp_engine_t (const options_t &options_) :
|
||||||
plugged (false),
|
plugged (false),
|
||||||
fd (-1),
|
fd (-1),
|
||||||
@ -448,8 +452,13 @@ void zmq::udp_engine_t::in_event ()
|
|||||||
int nbytes = recvfrom (fd, in_buffer, MAX_UDP_MSG, 0,
|
int nbytes = recvfrom (fd, in_buffer, MAX_UDP_MSG, 0,
|
||||||
(sockaddr *) &in_address, &in_addrlen);
|
(sockaddr *) &in_address, &in_addrlen);
|
||||||
if (nbytes == -1) {
|
if (nbytes == -1) {
|
||||||
|
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
|
||||||
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
||||||
&& errno != ENOTSOCK);
|
&& errno != ENOTSOCK);
|
||||||
|
#else
|
||||||
|
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
|
||||||
|
&& errno != ENOTSOCK);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user