mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
Better error handling for RL NET
This commit is contained in:
1 parent
d1c9d7ffdc
commit
1612e1d142
5 files changed
+158
-150
No files matched your search
+12
-9
@@ -63,7 +63,6 @@ typedef enum { false = 0, true = 1 } bool;
|
||||
#define MG_INVALID_SOCKET INVALID_SOCKET
|
||||
#define MG_SOCKET_TYPE SOCKET
|
||||
typedef unsigned long nfds_t;
|
||||
#define MG_SOCKET_ERRNO WSAGetLastError()
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#ifndef alloca
|
||||
@@ -71,9 +70,6 @@ typedef unsigned long nfds_t;
|
||||
#endif
|
||||
#endif
|
||||
#define poll(a, b, c) WSAPoll((a), (b), (c))
|
||||
#ifndef SO_EXCLUSIVEADDRUSE
|
||||
#define SO_EXCLUSIVEADDRUSE ((int) (~SO_REUSEADDR))
|
||||
#endif
|
||||
#define closesocket(x) closesocket(x)
|
||||
|
||||
typedef int socklen_t;
|
||||
@@ -83,13 +79,20 @@ typedef int socklen_t;
|
||||
#define MG_PATH_MAX FILENAME_MAX
|
||||
#endif
|
||||
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#endif
|
||||
#ifndef EWOULDBLOCK
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#ifndef SO_EXCLUSIVEADDRUSE
|
||||
#define SO_EXCLUSIVEADDRUSE ((int) (~SO_REUSEADDR))
|
||||
#endif
|
||||
|
||||
#define MG_SOCK_ERR(errcode) ((errcode) < 0 ? WSAGetLastError() : 0)
|
||||
|
||||
#define MG_SOCK_PENDING(errcode) \
|
||||
(((errcode) < 0) && \
|
||||
(WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || \
|
||||
WSAGetLastError() == WSAEWOULDBLOCK))
|
||||
|
||||
#define MG_SOCK_RESET(errcode) \
|
||||
(((errcode) < 0) && (WSAGetLastError() == WSAECONNRESET))
|
||||
|
||||
#define realpath(a, b) _fullpath((b), (a), MG_PATH_MAX)
|
||||
#define sleep(x) Sleep(x)
|
||||
#define mkdir(a, b) _mkdir(a)
|
||||
|
||||
Reference in new issue
Block a user