diff --git a/include/brain.h b/include/brain.h index 77af37081..a7c3f6417 100644 --- a/include/brain.h +++ b/include/brain.h @@ -31,7 +31,11 @@ #include #include #include +#if defined (__linux__) #define SEND_FLAGS MSG_NOSIGNAL +#else +#define SEND_FLAGS 0 +#endif #endif #include "xxhash.h" diff --git a/src/brain.c b/src/brain.c index eb179e03b..07e0fa7b3 100644 --- a/src/brain.c +++ b/src/brain.c @@ -901,9 +901,7 @@ bool brain_client_connect (hc_device_param_t *device_param, const status_ctx_t * return false; } - #if defined (_WIN) - - #else + #if defined (__linux__) const int one = 1; if (setsockopt (brain_link_client_fd, SOL_TCP, TCP_NODELAY, &one, sizeof (one)) == -1) @@ -914,6 +912,8 @@ bool brain_client_connect (hc_device_param_t *device_param, const status_ctx_t * return false; } + #else + #endif struct addrinfo hints; @@ -1990,9 +1990,7 @@ void *brain_server_handle_client (void *p) // client configuration - #if defined (_WIN) - - #else + #if defined (__linux__) const int one = 1; if (setsockopt (client_fd, SOL_TCP, TCP_NODELAY, &one, sizeof (one)) == -1) @@ -2003,6 +2001,8 @@ void *brain_server_handle_client (void *p) return NULL; } + #else + #endif u32 brain_link_version; @@ -2919,9 +2919,7 @@ int brain_server (const char *listen_host, const int listen_port, const char *br return -1; } - #if defined (_WIN) - - #else + #if defined (__linux__) const int one = 1; if (setsockopt (server_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof (one)) == -1) @@ -2937,6 +2935,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br return -1; } + #else + #endif struct sockaddr_in sa;