soc.2008.yahoo: b938a8d8: Proper error handling for p2p connection...

sulabh at soc.pidgin.im sulabh at soc.pidgin.im
Sat Jun 14 05:00:45 EDT 2008


-----------------------------------------------------------------
Revision: b938a8d8cfc7ad582e02ee62716e61d71a7c0be2
Ancestor: c1d570c12e7615d03450db53705eec4241f6ec3e
Author: sulabh at soc.pidgin.im
Date: 2008-06-14T08:53:43
Branch: im.pidgin.soc.2008.yahoo
URL: http://d.pidgin.im/viewmtn/revision/info/b938a8d8cfc7ad582e02ee62716e61d71a7c0be2

Modified files:
        libpurple/protocols/yahoo/yahoo.c

ChangeLog: 

Proper error handling for p2p connections

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	6f23514b2a526d31f29265b0fdb23ba48b163395
+++ libpurple/protocols/yahoo/yahoo.c	d35ceff92524f29110d0fe9b2d2c7f1af6aad8e0
@@ -2299,16 +2299,23 @@ static void yahoo_p2p_read_pkt_cb(gpoint
 	if(!(user_data = data))
 		return ;
 
-	if((len = read(source, buf, sizeof(buf))) <= 0 )	{
-		purple_debug_warning("yahoo","p2p: Error in connection to p2p host or host disconnected\n");
+	len = read(source, buf, sizeof(buf));
+
+	if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)))
+		return ; /* No Worries*/
+
+	else if (len <= 0)
+	{
+		purple_debug_warning("yahoo","p2p: Error in connection, or host disconnected\n");
 		purple_input_remove(user_data->input_event);
 		close(source);
 		/*free user data*/
 		g_free(user_data->host_ip);
 		g_free(user_data->host_username);
 		g_free(user_data);
+		return;
 	}
-
+	
 	if(len < YAHOO_PACKET_HDRLEN)
 		return;
 


More information about the Commits mailing list