Zebediah Figura : server: Do not set connectionless sockets into the CONNECTING or CONNECTED state.

Alexandre Julliard julliard at winehq.org
Tue Jul 19 15:55:01 CDT 2022


Module: wine
Branch: master
Commit: 8a4433d6a7755fb6b156563b166a9993f54c8103
URL:    https://gitlab.winehq.org/wine/wine/-/commit/8a4433d6a7755fb6b156563b166a9993f54c8103

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Sun May 29 17:32:28 2022 -0500

server: Do not set connectionless sockets into the CONNECTING or CONNECTED state.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53058

---

 dlls/ws2_32/tests/sock.c | 12 ++++++------
 server/sock.c            | 10 +++++++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 184285927b5..5ed0f286c55 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -13035,7 +13035,7 @@ static void test_connect_time(void)
     ok(!ret, "got %d\n", ret);
     ok(!GetLastError(), "got error %lu\n", GetLastError());
     ok(len == sizeof(time), "got len %d\n", len);
-    todo_wine ok(time == ~0u, "got time %u\n", time);
+    ok(time == ~0u, "got time %u\n", time);
 
     len = sizeof(time);
     SetLastError(0xdeadbeef);
@@ -13116,19 +13116,19 @@ static void test_connect_udp(void)
     todo_wine ok(GetLastError() == WSAENOTCONN, "got error %lu\n", GetLastError());
 
     ret = connect(client, (struct sockaddr *)&addr, sizeof(addr));
-    todo_wine ok(!ret, "got error %lu\n", GetLastError());
+    ok(!ret, "got error %lu\n", GetLastError());
     ++addr.sin_port;
     ret = connect(client, (struct sockaddr *)&addr, sizeof(addr));
-    todo_wine ok(!ret, "got error %lu\n", GetLastError());
+    ok(!ret, "got error %lu\n", GetLastError());
 
     memset(&addr, 0, sizeof(addr));
     addr.sin_family = AF_UNSPEC;
     ret = connect(client, (struct sockaddr *)&addr, sizeof(addr));
-    todo_wine ok(!ret, "got error %lu\n", GetLastError());
+    ok(!ret, "got error %lu\n", GetLastError());
 
     ret = getpeername(client, (struct sockaddr *)&ret_addr, &len);
-    todo_wine ok(ret == -1, "got %d\n", ret);
-    todo_wine ok(GetLastError() == WSAENOTCONN, "got error %lu\n", GetLastError());
+    ok(ret == -1, "got %d\n", ret);
+    ok(GetLastError() == WSAENOTCONN, "got error %lu\n", GetLastError());
 
     closesocket(server);
     closesocket(client);
diff --git a/server/sock.c b/server/sock.c
index 2bf56045612..4eef5c1ddb7 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -2385,13 +2385,17 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
 
         if (!ret)
         {
-            sock->state = SOCK_CONNECTED;
-            sock->connect_time = current_time;
+            if (sock->type != WS_SOCK_DGRAM)
+            {
+                sock->state = SOCK_CONNECTED;
+                sock->connect_time = current_time;
+            }
 
             if (!send_len) return;
         }
 
-        sock->state = SOCK_CONNECTING;
+        if (sock->type != WS_SOCK_DGRAM)
+            sock->state = SOCK_CONNECTING;
 
         if (params->synchronous && sock->nonblocking)
         {




More information about the wine-cvs mailing list