# HG changeset patch # User Sulabh Mahajan # Date 1213433623 0 # Node ID f1de4ccc433efa93b1e038cac30bed2d39799d0d # Parent 11e2d8a878b042430a2c3a041c7386cd74c76c9d Proper error handling for p2p connections diff -r 11e2d8a878b0 -r f1de4ccc433e libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Fri Jun 13 11:04:13 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Sat Jun 14 08:53:43 2008 +0000 @@ -2299,16 +2299,23 @@ 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;