Skip to content

Commit

Permalink
make windows and older libzmq's happy
Browse files Browse the repository at this point in the history
  • Loading branch information
sphaero committed Aug 31, 2021
1 parent a74e951 commit c0c6610
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/zoscdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ determine_socket( const char *bind)
if (zrex_eq(rex, bind, "^(.+)://.*") )
{
const char *transport = zrex_hit(rex, 1);
if ( streq(transport, "udp") )
retsock = zsock_new_dgram(bind);

if ( streq(transport, "ipc") )
retsock = zsock_new_pull( bind );
#ifdef ZMQ_DGRAM
else if ( streq(transport, "udp") )
retsock = zsock_new_dgram(bind);
#endif
#ifdef ZMQ_STREAM
else if ( streq(transport, "tcp") )
{
retsock = zsock_new(ZMQ_STREAM);
zsock_bind(retsock, bind);
zsock_bind(retsock, "%s", bind);
}

else if ( streq(transport, "ipc") )
retsock = zsock_new_pull( bind );
#endif

else
zsys_error("Not a valid transport in %s", transport);
Expand All @@ -70,6 +73,7 @@ determine_socket( const char *bind)
return NULL;
}


void
recv_dgram(zmsg_t *msg)
{
Expand Down Expand Up @@ -173,12 +177,16 @@ main (int argc, char *argv [])

switch ( zsock_type(which) )
{
#ifdef ZMQ_DGRAM
case ZMQ_DGRAM:
recv_dgram(msg);
break;
#endif
#ifdef ZMQ_STREAM
case ZMQ_STREAM:
recv_stream(msg);
break;
#endif
default:
zsys_error("Unsupported socket type");
break;
Expand All @@ -188,11 +196,11 @@ main (int argc, char *argv [])
}

zpoller_destroy(&poller);
zsock_t *sock = zlist_first(sockets);
zsock_t *sock = (zsock_t *)zlist_first(sockets);
while (sock)
{
zsock_destroy(&sock);
sock = zlist_next(sockets);
sock = (zsock_t *)zlist_next(sockets);
}

return ret;
Expand Down

0 comments on commit c0c6610

Please sign in to comment.