Unverified Commit 548f31d4 authored by Doron Somech's avatar Doron Somech Committed by GitHub

Merge pull request #3498 from sigiesec/fix-windows-build

Problem: syntax error on Windows related to socket descriptor type
parents d3f52b2b 63c4d8be
......@@ -685,14 +685,16 @@ ZMQ_EXPORT const char *zmq_msg_group (zmq_msg_t *msg);
#define ZMQ_HAVE_POLLER
typedef struct zmq_poller_event_t
{
void *socket;
#if defined _WIN32
SOCKET fd;
typedef SOCKET zmq_fd_t;
#else
int fd;
typedef int zmq_fd_t;
#endif
typedef struct zmq_poller_event_t
{
void *socket;
zmq_fd_t fd;
void *user_data;
short events;
} zmq_poller_event_t;
......@@ -709,19 +711,12 @@ ZMQ_EXPORT int zmq_poller_wait_all (void *poller,
zmq_poller_event_t *events,
int n_events,
long timeout);
ZMQ_EXPORT int zmq_poller_fd (void *poller);
ZMQ_EXPORT zmq_fd_t zmq_poller_fd (void *poller);
#if defined _WIN32
ZMQ_EXPORT int
zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events);
ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events);
ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd);
#else
ZMQ_EXPORT int
zmq_poller_add_fd (void *poller, int fd, void *user_data, short events);
ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events);
ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd);
#endif
zmq_poller_add_fd (void *poller, zmq_fd_t fd, void *user_data, short events);
ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, zmq_fd_t fd, short events);
ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, zmq_fd_t fd);
ZMQ_EXPORT int zmq_socket_get_peer_state (void *socket,
const void *routing_id,
......
......@@ -86,7 +86,7 @@ bool zmq::socket_poller_t::check_tag ()
return _tag == 0xCAFEBABE;
}
int zmq::socket_poller_t::signaler_fd ()
zmq::fd_t zmq::socket_poller_t::signaler_fd ()
{
if (_signaler) {
return _signaler->get_fd ();
......
......@@ -76,7 +76,7 @@ class socket_poller_t
int modify_fd (fd_t fd_, short events_);
int remove_fd (fd_t fd_);
// Returns the signaler's fd if there is one, otherwise errors.
int signaler_fd ();
fd_t signaler_fd ();
int wait (event_t *event_, int n_events_, long timeout_);
......
......@@ -1278,7 +1278,7 @@ int zmq_poller_wait_all (void *poller_,
return rc;
}
int zmq_poller_fd (void *poller_)
zmq_fd_t zmq_poller_fd (void *poller_)
{
if (!poller_
|| !(static_cast<zmq::socket_poller_t *> (poller_)->check_tag ())) {
......
......@@ -80,14 +80,16 @@ const char *zmq_msg_group (zmq_msg_t *msg_);
/* Poller polling on sockets,fd and thread-safe sockets */
/******************************************************************************/
typedef struct zmq_poller_event_t
{
void *socket;
#if defined _WIN32
SOCKET fd;
typedef SOCKET zmq_fd_t;
#else
int fd;
typedef int zmq_fd_t;
#endif
typedef struct zmq_poller_event_t
{
void *socket;
zmq_fd_t fd;
void *user_data;
short events;
} zmq_poller_event_t;
......@@ -105,20 +107,14 @@ int zmq_poller_wait_all (void *poller_,
zmq_poller_event_t *events_,
int n_events_,
long timeout_);
int zmq_poller_fd (void *poller_);
zmq_fd_t zmq_poller_fd (void *poller_);
#if defined _WIN32
int zmq_poller_add_fd (void *poller_,
SOCKET fd_,
zmq_fd_t fd_,
void *user_data_,
short events_);
int zmq_poller_modify_fd (void *poller_, SOCKET fd_, short events_);
int zmq_poller_remove_fd (void *poller_, SOCKET fd_);
#else
int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events);
int zmq_poller_modify_fd (void *poller, int fd, short events);
int zmq_poller_remove_fd (void *poller, int fd);
#endif
int zmq_poller_modify_fd (void *poller_, zmq_fd_t fd_, short events_);
int zmq_poller_remove_fd (void *poller_, zmq_fd_t fd_);
int zmq_socket_get_peer_state (void *socket_,
const void *routing_id_,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment