From ef34431d8483a61493b02dd4e70b301e29c4873d Mon Sep 17 00:00:00 2001
From: Constantin Papizh <p.const@bk.ru>
Date: Wed, 4 Dec 2019 21:34:16 +0300
Subject: [PATCH] Win build fixes

---
 include/dap_server.h    | 2 ++
 src/dap_client_remote.c | 1 -
 src/dap_events.c        | 1 -
 src/dap_server.c        | 6 +++---
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/dap_server.h b/include/dap_server.h
index 2a22a50..a226961 100755
--- a/include/dap_server.h
+++ b/include/dap_server.h
@@ -27,6 +27,8 @@
 #define EPOLL_HANDLE  int
 #else
 #define EPOLL_HANDLE  HANDLE
+#define MSG_DONTWAIT 0
+#define MSG_NOSIGNAL 0
 #include "wepoll.h"
 #endif
 
diff --git a/src/dap_client_remote.c b/src/dap_client_remote.c
index bedf026..25adc19 100755
--- a/src/dap_client_remote.c
+++ b/src/dap_client_remote.c
@@ -36,7 +36,6 @@
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include <io.h>
-//#include "wrappers.h"
 #include <pthread.h>
 #endif
 
diff --git a/src/dap_events.c b/src/dap_events.c
index 3f6e9eb..495b556 100755
--- a/src/dap_events.c
+++ b/src/dap_events.c
@@ -59,7 +59,6 @@
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include <io.h>
-#include "wrappers.h"
 #include <pthread.h>
 #endif
 
diff --git a/src/dap_server.c b/src/dap_server.c
index b423f7d..9931f26 100755
--- a/src/dap_server.c
+++ b/src/dap_server.c
@@ -50,7 +50,6 @@
 #include <windows.h>
 #include <mswsock.h>
 #include <ws2tcpip.h>
-#include "wrappers.h"
 #include <io.h>
 #include <pthread.h>
 #endif
@@ -642,12 +641,13 @@ void  *thread_loop( void *arg )
       }
 
       dap_cur->last_time_active = cur_time;
-
       if( events[i].events & EPOLLERR ) {
           log_it( L_ERROR,"Socket error: %u, remove it" , dap_cur->socket );
           dap_cur->flags |= DAP_SOCK_SIGNAL_CLOSE;
       }
-
+#ifdef _WIN32
+      set_nonblock_socket(dap_cur->socket); // pconst: for winsock2 has no appropriate MSG attributes
+#endif
       if ( !(dap_cur->flags & DAP_SOCK_SIGNAL_CLOSE) || dap_cur->no_close )
         read_write_cb( dap_cur, events[i].events );
 
-- 
GitLab