Winsock fixes.
This commit is contained in:
parent
d01813ef48
commit
3bc764adf5
|
@ -185,7 +185,11 @@ void net_on_accept(struct net_connection* con, int event, void *arg)
|
|||
int fd = net_accept(server_fd, &ipaddr);
|
||||
if (fd == -1)
|
||||
{
|
||||
#ifdef WINSOCK
|
||||
if (net_error() == WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (net_error() == EWOULDBLOCK)
|
||||
#endif
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -371,8 +371,13 @@ int net_accept(int fd, struct ip_addr_encap* ipaddr)
|
|||
case EOPNOTSUPP:
|
||||
errno = EWOULDBLOCK;
|
||||
#endif
|
||||
#ifdef WINSOCK
|
||||
case WSAEWOULDBLOCK:
|
||||
break;
|
||||
#else
|
||||
case EWOULDBLOCK:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
net_error_out(fd, "net_accept");
|
||||
net_stats_add_error();
|
||||
|
@ -418,7 +423,11 @@ int net_connect(int fd, const struct sockaddr *serv_addr, socklen_t addrlen)
|
|||
int ret = connect(fd, serv_addr, addrlen);
|
||||
if (ret == -1)
|
||||
{
|
||||
#ifdef WINSOCK
|
||||
if (net_error() != WSAEINPROGRESS)
|
||||
#else
|
||||
if (net_error() != EINPROGRESS)
|
||||
#endif
|
||||
{
|
||||
net_error_out(fd, "net_connect");
|
||||
net_stats_add_error();
|
||||
|
@ -684,7 +693,11 @@ ssize_t net_recv(int fd, void* buf, size_t len, int flags)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef WINSOCK
|
||||
if (net_error() != WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (net_error() != EWOULDBLOCK)
|
||||
#endif
|
||||
{
|
||||
/* net_error_out(fd, "net_recv"); */
|
||||
net_stats_add_error();
|
||||
|
@ -703,7 +716,11 @@ ssize_t net_send(int fd, const void* buf, size_t len, int flags)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef WINSOCK
|
||||
if (net_error() != WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (net_error() != EWOULDBLOCK)
|
||||
#endif
|
||||
{
|
||||
/* net_error_out(fd, "net_send"); */
|
||||
net_stats_add_error();
|
||||
|
|
|
@ -254,46 +254,4 @@ extern void net_stats_add_close();
|
|||
extern int net_stats_timeout();
|
||||
extern void net_stats_get(struct net_statistics** intermediate, struct net_statistics** total);
|
||||
|
||||
|
||||
#if defined(WINSOCK) && !defined(__CYGWIN__) && !defined(_MSC_VER)
|
||||
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EALREADY WSAEALREADY
|
||||
#define ENOTSOCK WSAENOTSOCK
|
||||
#define EDESTADDRREQ WSAEDESTADDRREQ
|
||||
#define EMSGSIZE WSAEMSGSIZE
|
||||
#define EPROTOTYPE WSAEPROTOTYPE
|
||||
#define ENOPROTOOPT WSAENOPROTOOPT
|
||||
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
||||
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
||||
#define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
#define EPFNOSUPPORT WSAEPFNOSUPPORT
|
||||
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
#define EADDRINUSE WSAEADDRINUSE
|
||||
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
#define ENETDOWN WSAENETDOWN
|
||||
#define ENETUNREACH WSAENETUNREACH
|
||||
#define ENETRESET WSAENETRESET
|
||||
#define ECONNABORTED WSAECONNABORTED
|
||||
#define ECONNRESET WSAECONNRESET
|
||||
#define ENOBUFS WSAENOBUFS
|
||||
#define EISCONN WSAEISCONN
|
||||
#define ENOTCONN WSAENOTCONN
|
||||
#define ESHUTDOWN WSAESHUTDOWN
|
||||
#define ETOOMANYREFS WSAETOOMANYREFS
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#define ELOOP WSAELOOP
|
||||
#define EHOSTDOWN WSAEHOSTDOWN
|
||||
#define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#define EPROCLIM WSAEPROCLIM
|
||||
#define EUSERS WSAEUSERS
|
||||
#define EDQUOT WSAEDQUOT
|
||||
#define ESTALE WSAESTALE
|
||||
#define EREMOTE WSAEREMOTE
|
||||
|
||||
#endif /* WINSOCK && !__CYGWIN__ */
|
||||
|
||||
|
||||
#endif /* HAVE_UHUB_NETWORK_H */
|
||||
|
|
Loading…
Reference in New Issue