[libsoup/gnome-3-4] SoupSocket: don't emit "readable" on disconnect for blocking sockets



commit ae6bc194cb4c0a1c3e2cee64b4df2a07aa666542
Author: Dan Winship <danw gnome org>
Date:   Thu Jul 19 08:49:55 2012 -0400

    SoupSocket: don't emit "readable" on disconnect for blocking sockets
    
    "readable" and "writable" are only supposed to be emitted for
    non-blocking sockets, but we were emitting "readable" on disconnect
    for all sockets.
    
    This could cause a crash if a message in a SoupSessionSync failed at
    certain points, since the code wasn't expecting to end up in
    io_read().

 libsoup/soup-socket.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index 26c90c4..1f1d07c 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -1225,8 +1225,10 @@ soup_socket_disconnect (SoupSocket *sock)
 	 */
 	g_object_ref (sock);
 
-	/* Give all readers a chance to notice the connection close */
-	g_signal_emit (sock, signals[READABLE], 0);
+	if (priv->non_blocking) {
+		/* Give all readers a chance to notice the connection close */
+		g_signal_emit (sock, signals[READABLE], 0);
+	}
 
 	/* FIXME: can't disconnect until all data is read */
 



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