From c879cb433e9d498bdd5c1aa9b9b78b236b95d87a 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 a59f0f5a..122f6a78 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) { @@ -334,9 +339,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;