comparison libpurple/protocols/yahoo/yahoo.c @ 26153: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
comparison
equal deleted inserted replaced
26152:bb5a6709d9b7 26153:1317a9ae66e8
2611 yd = p2p_data->gc->proto_data; 2611 yd = p2p_data->gc->proto_data;
2612 2612
2613 purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect"); 2613 purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect");
2614 yahoo_p2p_disconnect_destroy_data(data); 2614 yahoo_p2p_disconnect_destroy_data(data);
2615 purple_input_remove(yd->yahoo_p2p_server_watcher); 2615 purple_input_remove(yd->yahoo_p2p_server_watcher);
2616 yd->yahoo_p2p_server_watcher = 0;
2616 close(yd->yahoo_local_p2p_server_fd); 2617 close(yd->yahoo_local_p2p_server_fd);
2617 yd->yahoo_local_p2p_server_fd = -1; 2618 yd->yahoo_local_p2p_server_fd = -1;
2619 yd->yahoo_p2p_server_timeout_handle = 0;
2618 2620
2619 return FALSE; 2621 return FALSE;
2620 } 2622 }
2621 2623
2622 static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) 2624 static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data)
2659 2661
2660 f = yahoo_friend_find(gc, who); 2662 f = yahoo_friend_find(gc, who);
2661 account = purple_connection_get_account(gc); 2663 account = purple_connection_get_account(gc);
2662 2664
2663 /* Do not send invitation if already listening for other connection */ 2665 /* Do not send invitation if already listening for other connection */
2664 if(yd->yahoo_local_p2p_server_fd) 2666 if(yd->yahoo_local_p2p_server_fd >= 0)
2665 return; 2667 return;
2666 2668
2667 /* One shouldn't try to connect to self */ 2669 /* One shouldn't try to connect to self */
2668 if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0) 2670 if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0)
2669 return; 2671 return;
3642 yd->chat_online = 0; 3644 yd->chat_online = 0;
3643 if (yd->in_chat) 3645 if (yd->in_chat)
3644 yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ 3646 yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */
3645 3647
3646 purple_timeout_remove(yd->yahoo_p2p_timer); 3648 purple_timeout_remove(yd->yahoo_p2p_timer);
3649 if(yd->yahoo_p2p_server_timeout_handle != 0)
3650 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
3647 3651
3648 /* close p2p server if it is waiting for a peer to connect */ 3652 /* close p2p server if it is waiting for a peer to connect */
3649 purple_input_remove(yd->yahoo_p2p_server_watcher); 3653 purple_input_remove(yd->yahoo_p2p_server_watcher);
3650 close(yd->yahoo_local_p2p_server_fd); 3654 close(yd->yahoo_local_p2p_server_fd);
3651 yd->yahoo_local_p2p_server_fd = -1; 3655 yd->yahoo_local_p2p_server_fd = -1;