From: Tim R. <ma...@us...> - 2004-08-21 02:02:35
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3485/src Modified Files: ft.c Log Message: This is patch number 1002252 by Joe Shaw. He writes: If you start a file transfer with a yahoo user and then unplug the network, wait a couple minutes, and plug it back in, a minute or so later the gaim UI will completely freeze, eventually consume all your memory and crash. This is because ft.c:transfer_cb() does not correctly handle the case in which both READ and WRITE conditions are coming in, and because the yahoo_xfer_read() and yahoo_xfer_write() functions are incorrectly returning 0 on errors instead of -1. Since transfer_cb() is getting both conditions, it only checks READ first and gets back 0 bytes (because the connection has been hung up). 0 is not explicitly handled, so nothing is done and we get ourselves into an infinite loop. Index: ft.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/ft.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -p -r1.69 -r1.70 --- ft.c 20 Aug 2004 21:57:18 -0000 1.69 +++ ft.c 21 Aug 2004 02:02:25 -0000 1.70 @@ -666,7 +666,7 @@ transfer_cb(gpointer data, gint source, GaimXferUiOps *ui_ops; GaimXfer *xfer = (GaimXfer *)data; char *buffer = NULL; - ssize_t r; + ssize_t r = 0; if (condition & GAIM_INPUT_READ) { r = gaim_xfer_read(xfer, &buffer); @@ -677,13 +677,14 @@ transfer_cb(gpointer data, gint source, return; } } - else { + + if (condition & GAIM_INPUT_WRITE) { size_t s = MIN(gaim_xfer_get_bytes_remaining(xfer), 4096); /* this is so the prpl can keep the connection open if it needs to for some odd reason. */ if (s == 0) { - if(xfer->watcher) { + if (xfer->watcher) { gaim_input_remove(xfer->watcher); xfer->watcher = 0; } |