[libsoup/carlosgc/io-split: 2/5] logger: pass the SoupBodyOutputStream to soup_logger_request_body_setup()




commit 1932628b3b8cebd0a52055a3d7c1bd5b0221b9b1
Author: Patrick Griffis <pgriffis igalia com>
Date:   Thu Apr 22 11:55:35 2021 +0200

    logger: pass the SoupBodyOutputStream to soup_logger_request_body_setup()

 libsoup/soup-logger-private.h |  4 +++-
 libsoup/soup-logger.c         | 11 ++++++-----
 libsoup/soup-message-io.c     |  6 ++++--
 3 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/libsoup/soup-logger-private.h b/libsoup/soup-logger-private.h
index 8307319a..a30eb396 100644
--- a/libsoup/soup-logger-private.h
+++ b/libsoup/soup-logger-private.h
@@ -9,6 +9,8 @@
 
 G_BEGIN_DECLS
 
-void soup_logger_request_body_setup (SoupLogger *logger, SoupMessage *msg);
+void soup_logger_request_body_setup (SoupLogger           *logger,
+                                     SoupMessage          *msg,
+                                     SoupBodyOutputStream *stream);
 
 G_END_DECLS
diff --git a/libsoup/soup-logger.c b/libsoup/soup-logger.c
index c9899e22..dab00f55 100644
--- a/libsoup/soup-logger.c
+++ b/libsoup/soup-logger.c
@@ -841,16 +841,17 @@ body_ostream_done (gpointer data, GObject *bostream)
 }
 
 void
-soup_logger_request_body_setup (SoupLogger *logger, SoupMessage *msg)
+soup_logger_request_body_setup (SoupLogger           *logger,
+                                SoupMessage          *msg,
+                                SoupBodyOutputStream *stream)
 {
         SoupLoggerPrivate *priv = soup_logger_get_instance_private (logger);
-        SoupMessageIOData *io = (SoupMessageIOData *)soup_message_get_io_data (msg);
 
-        g_hash_table_insert (priv->request_messages, io->body_ostream, msg);
-        g_signal_connect_object (io->body_ostream, "wrote-data",
+        g_hash_table_insert (priv->request_messages, stream, msg);
+        g_signal_connect_object (stream, "wrote-data",
                                  G_CALLBACK (body_stream_wrote_data_cb),
                                  logger, 0);
-        g_object_weak_ref (G_OBJECT (io->body_ostream), body_ostream_done, priv);
+        g_object_weak_ref (G_OBJECT (stream), body_ostream_done, priv);
 }
 
 static void
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 4fdb5b4d..8e318ad6 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -377,8 +377,10 @@ io_write (SoupMessage *msg, gboolean blocking,
                io->write_state = SOUP_MESSAGE_IO_STATE_BODY;
                logger = soup_session_get_feature_for_message (client_io->item->session,
                                                               SOUP_TYPE_LOGGER, msg);
-               if (logger)
-                       soup_logger_request_body_setup (SOUP_LOGGER (logger), msg);
+               if (logger) {
+                       soup_logger_request_body_setup (SOUP_LOGGER (logger), msg,
+                                                        SOUP_BODY_OUTPUT_STREAM (io->body_ostream));
+                }
                break;
 
        case SOUP_MESSAGE_IO_STATE_BODY:


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