changeset 21587:fd87b254d3f3

Fix #3983 by canceling the file transfer when connecting to the remote host fails.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Nov 2007 03:16:29 +0000
parents 948e5c7a558f
children 25a522f544f9
files libpurple/ft.c libpurple/protocols/irc/dcc_send.c
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/ft.c	Mon Nov 19 03:10:41 2007 +0000
+++ b/libpurple/ft.c	Mon Nov 19 03:16:29 2007 +0000
@@ -998,6 +998,11 @@
 {
 	PurpleXfer *xfer = (PurpleXfer *)data;
 
+	if (source < 0) {
+		purple_xfer_cancel_local(xfer);
+		return;
+	}
+
 	xfer->fd = source;
 
 	begin_transfer(xfer, PURPLE_INPUT_READ);
--- a/libpurple/protocols/irc/dcc_send.c	Mon Nov 19 03:10:41 2007 +0000
+++ b/libpurple/protocols/irc/dcc_send.c	Mon Nov 19 03:16:29 2007 +0000
@@ -40,9 +40,7 @@
 {
 	struct irc_xfer_rx_data *xd = xfer->data;
 
-	if (xd->ip != NULL)
-		g_free(xd->ip);
-
+	g_free(xd->ip);
 	g_free(xd);
 }
 
@@ -123,8 +121,8 @@
 		} else {
 			xd->ip = g_strdup(token[i]);
 		}
-		purple_debug(PURPLE_DEBUG_INFO, "irc", "Receiving file from %s\n",
-				   xd->ip);
+		purple_debug(PURPLE_DEBUG_INFO, "irc", "Receiving file (%s) from %s\n",
+			     filename->str, xd->ip);
 		purple_xfer_set_size(xfer, token[i+2] ? atoi(token[i+2]) : 0);
 		
 		purple_xfer_set_init_fnc(xfer, irc_dccsend_recv_init);
@@ -166,8 +164,7 @@
 	if (xd->fd != -1)
 		close(xd->fd);
 
-	if (xd->rxqueue)
-		g_free(xd->rxqueue);
+	g_free(xd->rxqueue);
 
 	g_free(xd);
 }