[libsoup/carlosgc/http2-close-idle: 11/12] http2: do not use g_idle_add to close the connection after goaway is sent
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/carlosgc/http2-close-idle: 11/12] http2: do not use g_idle_add to close the connection after goaway is sent
- Date: Fri, 11 Mar 2022 09:02:20 +0000 (UTC)
commit 953285ea6425aed6398d5d6cf65126c89618b252
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jan 11 10:29:07 2022 +0100
http2: do not use g_idle_add to close the connection after goaway is sent
We need to use our own source to attach it to the current thread context
instead of the main one.
Fixes #260
libsoup/http2/soup-client-message-io-http2.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 2dd1e356..78817b8a 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -864,8 +864,14 @@ on_frame_send_callback (nghttp2_session *session,
h2_debug (io, data, "[SEND] [%s]", frame_type_to_string (frame->hd.type));
io->goaway_sent = TRUE;
if (io->close_task) {
+ GSource *source;
+
/* Close in idle to ensure all pending io is finished first */
- g_idle_add ((GSourceFunc)close_in_idle_cb, io);
+ source = g_idle_source_new ();
+ g_source_set_name (source, "Soup HTTP/2 close source");
+ g_source_set_callback (source, (GSourceFunc)close_in_idle_cb, io, NULL);
+ g_source_attach (source, g_main_context_get_thread_default ());
+ g_source_unref (source);
}
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]