[libsoup] soup-message-io: don't watch for SoupSocket::disconnect



commit 223db09654af305adddc3cf4389dca4329b634b1
Author: Dan Winship <danw gnome org>
Date:   Mon Jan 10 12:50:21 2011 -0500

    soup-message-io: don't watch for SoupSocket::disconnect
    
    The IO code was explicitly handling the SoupSocket::disconnect signal,
    but this is actually redundant; if the socket gets disconnected we'll
    get either an error (if writing) or an eof (if reading), and the code
    will do the right thing with that. Watching ::disconnected too just
    results in processing the same error twice and having to be extra
    careful to do it idempotently.

 libsoup/soup-message-io.c |   24 +-----------------------
 1 files changed, 1 insertions(+), 23 deletions(-)
---
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index d78aa39..5a79d2f 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -67,7 +67,7 @@ typedef struct {
 	goffset               write_length;
 	goffset               written;
 
-	guint read_tag, write_tag, err_tag, tls_signal_id;
+	guint read_tag, write_tag, tls_signal_id;
 	GSource *unpause_source;
 
 	SoupMessageGetHeadersFn   get_headers_cb;
@@ -137,10 +137,6 @@ soup_message_io_stop (SoupMessage *msg)
 		g_signal_handler_disconnect (io->sock, io->write_tag);
 		io->write_tag = 0;
 	}
-	if (io->err_tag) {
-		g_signal_handler_disconnect (io->sock, io->err_tag);
-		io->err_tag = 0;
-	}
 
 	if (io->unpause_source) {
 		g_source_destroy (io->unpause_source);
@@ -207,22 +203,6 @@ io_error (SoupSocket *sock, SoupMessage *msg, GError *error)
 	soup_message_io_finished (msg);
 }
 
-static void
-io_disconnected (SoupSocket *sock, SoupMessage *msg)
-{
-	SoupMessagePrivate *priv = SOUP_MESSAGE_GET_PRIVATE (msg);
-	SoupMessageIOData *io = priv->io_data;
-
-	/* Closing the connection to signify EOF is sometimes ok */
-	if (io->read_state == SOUP_MESSAGE_IO_STATE_BODY && io->read_eof_ok) {
-		io->read_state = SOUP_MESSAGE_IO_STATE_FINISHING;
-		io_read (sock, msg);
-		return;
-	}
-
-	io_error (sock, msg, NULL);
-}
-
 static gboolean
 io_handle_sniffing (SoupMessage *msg, gboolean done_reading)
 {
@@ -1112,8 +1092,6 @@ new_iostate (SoupMessage *msg, SoupSocket *sock, SoupMessageIOMode mode,
 					  G_CALLBACK (io_read), msg);
 	io->write_tag = g_signal_connect (io->sock, "writable",
 					  G_CALLBACK (io_write), msg);
-	io->err_tag   = g_signal_connect (io->sock, "disconnected",
-					  G_CALLBACK (io_disconnected), msg);
 
 	io->read_state  = SOUP_MESSAGE_IO_STATE_NOT_STARTED;
 	io->write_state = SOUP_MESSAGE_IO_STATE_NOT_STARTED;



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