SoupServer: fix non-default-main-context usage
authorDan Winship <danw@gnome.org>
Wed, 18 Jul 2012 21:43:12 +0000 (17:43 -0400)
committerDan Winship <danw@gnome.org>
Wed, 18 Jul 2012 21:43:12 +0000 (17:43 -0400)
Need to push the server's async_context around doing message I/O to
make sure all the responses come back to the right place.

libsoup/soup-server.c

index 5dcafa1..1e462ea 100644 (file)
@@ -938,8 +938,13 @@ start_request (SoupServer *server, SoupClientContext *client)
                       msg, client);
 
        g_object_ref (client->sock);
+
+       if (priv->async_context)
+               g_main_context_push_thread_default (priv->async_context);
        soup_message_read_request (msg, client->sock,
                                   request_finished, client);
+       if (priv->async_context)
+               g_main_context_pop_thread_default (priv->async_context);
 }
 
 static void