Cygwin/Mingw32 compile fixes.
This commit is contained in:
parent
e4df1884d2
commit
5068fe8351
@ -156,7 +156,13 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len)
|
||||
ret = net_send(con->sd, buf, len, UHUB_SEND_SIGNAL);
|
||||
if (ret == -1)
|
||||
{
|
||||
if (net_error() == EWOULDBLOCK || net_error() == EINTR)
|
||||
if (
|
||||
#ifdef WINSOCK
|
||||
net_error() == WSAEWOULDBLOCK
|
||||
#else
|
||||
net_error() == EWOULDBLOCK
|
||||
#endif
|
||||
|| net_error() == EINTR)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
@ -190,7 +196,13 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len)
|
||||
ret = net_recv(con->sd, buf, len, 0);
|
||||
if (ret == -1)
|
||||
{
|
||||
if (net_error() == EWOULDBLOCK || net_error() == EINTR)
|
||||
if (
|
||||
#ifdef WINSOCK
|
||||
net_error() == WSAEWOULDBLOCK
|
||||
#else
|
||||
net_error() == EWOULDBLOCK
|
||||
#endif
|
||||
|| net_error() == EINTR)
|
||||
return 0;
|
||||
return -net_error();
|
||||
}
|
||||
@ -226,7 +238,13 @@ ssize_t net_con_peek(struct net_connection* con, void* buf, size_t len)
|
||||
int ret = net_recv(con->sd, buf, len, MSG_PEEK);
|
||||
if (ret == -1)
|
||||
{
|
||||
if (net_error() == EWOULDBLOCK || net_error() == EINTR)
|
||||
if (
|
||||
#ifdef WINSOCK
|
||||
net_error() == WSAEWOULDBLOCK
|
||||
#else
|
||||
net_error() == EWOULDBLOCK
|
||||
#endif
|
||||
|| net_error() == EINTR)
|
||||
return 0;
|
||||
return -net_error();
|
||||
}
|
||||
|
@ -36,6 +36,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
#define HAVE_SSIZE_T
|
||||
#define NEED_GETOPT
|
||||
#endif
|
||||
|
||||
#ifdef WINSOCK
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 4096
|
||||
|
Loading…
Reference in New Issue
Block a user