[libsoup] soup-session: Warn if [un]pausing messages from a sync session



commit 5afc190b6c968a7f06ed5dcb0310384b9840f0fd
Author: Philip Withnall <philip tecnocode co uk>
Date:   Fri Jul 5 19:14:17 2013 +0100

    soup-session: Warn if [un]pausing messages from a sync session
    
    It was never meant to work, and can lead to weird behaviour and crashes.
    Also mention this more explicitly in the documentation for
    soup_session_[un]pause_message().
    
    Helps: https://bugzilla.gnome.org/show_bug.cgi?id=703461

 libsoup/soup-session.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 95436f3..10851b3 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -2109,6 +2109,9 @@ soup_session_send_message (SoupSession *session, SoupMessage *msg)
  *
  * Pauses HTTP I/O on @msg. Call soup_session_unpause_message() to
  * resume I/O.
+ *
+ * This may only be called for asynchronous messages (those sent on a
+ * #SoupSessionAsync or using soup_session_queue_message()).
  **/
 void
 soup_session_pause_message (SoupSession *session,
@@ -2123,6 +2126,7 @@ soup_session_pause_message (SoupSession *session,
        priv = SOUP_SESSION_GET_PRIVATE (session);
        item = soup_message_queue_lookup (priv->queue, msg);
        g_return_if_fail (item != NULL);
+       g_return_if_fail (item->async);
 
        item->paused = TRUE;
        if (item->state == SOUP_MESSAGE_RUNNING)
@@ -2186,6 +2190,9 @@ soup_session_kick_queue (SoupSession *session)
  * If @msg is being sent via blocking I/O, this will resume reading or
  * writing immediately. If @msg is using non-blocking I/O, then
  * reading or writing won't resume until you return to the main loop.
+ *
+ * This may only be called for asynchronous messages (those sent on a
+ * #SoupSessionAsync or using soup_session_queue_message()).
  **/
 void
 soup_session_unpause_message (SoupSession *session,
@@ -2200,6 +2207,7 @@ soup_session_unpause_message (SoupSession *session,
        priv = SOUP_SESSION_GET_PRIVATE (session);
        item = soup_message_queue_lookup (priv->queue, msg);
        g_return_if_fail (item != NULL);
+       g_return_if_fail (item->async);
 
        item->paused = FALSE;
        if (item->state == SOUP_MESSAGE_RUNNING)


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