@@ -111,6 +111,15 @@ typedef void (*procedure_t)(void* userdata);
#define LIMIT(lower, v, upper) ((v) < (lower) ? (lower) : (v) > (upper) ? (upper) : (v))
#endif
+#ifndef SWAP
+#define SWAP(type, a, b) \
+ do {\
+ type x = a;\
+ a = b;\
+ b = x;\
+ } while(0)
+#endif
+
#ifndef BITSET
#define BITSET(p, n) (*(p) |= (1u << (n)))
@@ -67,6 +67,7 @@ static inline int nonblocking(int sockfd) {
#define blocking(s) fcntl(s, F_SETFL, fcntl(s, F_GETFL) & ~O_NONBLOCK)
#define nonblocking(s) fcntl(s, F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK)
typedef int SOCKET;
+#define INVALID_SOCKET -1
#define closesocket close
@@ -335,7 +335,7 @@ static int __http_session_send(http_session_t* hss, HttpRequest* req, HttpRespon
// connect -> send -> recv -> http_parser
int err = 0;
int timeout = hss->timeout;
- SOCKET connfd = hss->fd;
+ int connfd = hss->fd;
// use_tls ?
int use_tls = hss->use_tls;