changeset 26235:1317a9ae66e8

set yahoo_p2p_server_watcher, yahoo_p2p_server_timeout_handle to 0; check for nonnegative fd instead of nonzero; purple_timeout_remove yahoo_p2p_server_timeout_handle when disconnecting.
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Wed, 12 Nov 2008 08:19:56 +0000
parents bb5a6709d9b7
children 618d122af044
files libpurple/protocols/yahoo/yahoo.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Sun Sep 28 16:03:24 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Wed Nov 12 08:19:56 2008 +0000
@@ -2613,8 +2613,10 @@
 	purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect");
 	yahoo_p2p_disconnect_destroy_data(data);
 	purple_input_remove(yd->yahoo_p2p_server_watcher);
+	yd->yahoo_p2p_server_watcher = 0;
 	close(yd->yahoo_local_p2p_server_fd);
 	yd->yahoo_local_p2p_server_fd = -1;
+	yd->yahoo_p2p_server_timeout_handle = 0;
 
 	return FALSE;
 }
@@ -2661,7 +2663,7 @@
 	account = purple_connection_get_account(gc);
 
 	/* Do not send invitation if already listening for other connection */
-	if(yd->yahoo_local_p2p_server_fd)
+	if(yd->yahoo_local_p2p_server_fd >= 0)
 		return;
 
 	/* One shouldn't try to connect to self */
@@ -3644,6 +3646,8 @@
 		yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */
 
 	purple_timeout_remove(yd->yahoo_p2p_timer);
+	if(yd->yahoo_p2p_server_timeout_handle != 0)
+		purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
 
 	/* close p2p server if it is waiting for a peer to connect */
 	purple_input_remove(yd->yahoo_p2p_server_watcher);