[glib-networking] tests: ensure DTLS tests iterate the correct MainContext



commit d52c5522d97048b6d580f10b1c3bc9ea5f003f61
Author: Ole André Vadla Ravnås <oleavr gmail com>
Date:   Wed May 26 12:28:50 2021 +0200

    tests: ensure DTLS tests iterate the correct MainContext
    
    This would typically result in the server getting stuck handshaking
    while waiting for the certificate to be accepted. Because the server
    was iterating the client's MainContext instead of its own, nothing was
    actually iterating the server's MainContext.

 tls/tests/dtls-connection.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/tls/tests/dtls-connection.c b/tls/tests/dtls-connection.c
index 7244c08..2ccd058 100644
--- a/tls/tests/dtls-connection.c
+++ b/tls/tests/dtls-connection.c
@@ -257,7 +257,7 @@ on_rehandshake_finish (GObject        *object,
                                                &message, 1,
                                                G_SOCKET_MSG_NONE, 0, NULL,
                                                &test->server_error);
-      g_main_context_iteration (NULL, FALSE);
+      g_main_context_iteration (test->server_context, FALSE);
     }
   while (g_error_matches (test->server_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK));
 
@@ -304,7 +304,7 @@ on_rehandshake_finish_threaded (GObject      *object,
                                                &message, 1,
                                                G_SOCKET_MSG_NONE, 0, NULL,
                                                &test->server_error);
-      g_main_context_iteration (NULL, FALSE);
+      g_main_context_iteration (test->server_context, FALSE);
     }
   while (g_error_matches (test->server_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK));
 
@@ -429,7 +429,7 @@ on_incoming_connection (GSocket       *socket,
                                                &message, 1,
                                                G_SOCKET_MSG_NONE, 0, NULL,
                                                &test->server_error);
-      g_main_context_iteration (NULL, FALSE);
+      g_main_context_iteration (test->server_context, FALSE);
     }
   while (g_error_matches (test->server_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK));
 
@@ -530,7 +530,7 @@ on_incoming_connection_threaded (GSocket      *socket,
                                                G_SOCKET_MSG_NONE,
                                                test->test_data->server_timeout, NULL,
                                                &test->server_error);
-      g_main_context_iteration (NULL, FALSE);
+      g_main_context_iteration (test->server_context, FALSE);
     }
   while (g_error_matches (test->server_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]