From 0421ea2101c8c43d5375b4bec7ffcd712d8336fe Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Mon, 4 Feb 2019 17:23:31 +0100 Subject: [PATCH] - fixed bug in windows socket abstraction --- hal/socket/win32/socket_win32.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index b3b8f389..a75eaccc 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -279,6 +279,8 @@ ServerSocket_accept(ServerSocket self) conSocket = (Socket) GLOBAL_CALLOC(1, sizeof(struct sSocket)); conSocket->fd = fd; + socketCount++; + setSocketNonBlocking(conSocket); } @@ -305,6 +307,9 @@ TcpSocket_create() { Socket self = NULL; + if (wsaStartUp() == false) + return NULL; + int sock = socket(AF_INET, SOCK_STREAM, 0); if (sock != INVALID_SOCKET) { @@ -405,9 +410,6 @@ Socket_connect(Socket self, const char* address, int port) { struct sockaddr_in serverAddress; - if (wsaStartUp() == false) - return false; - if (!prepareServerAddress(address, port, &serverAddress)) return false;