Mercurial > pidgin.yaz
comparison src/ft.c @ 9798:255596f41014
[gaim-migrate @ 10666]
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.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sat, 21 Aug 2004 02:02:25 +0000 |
parents | 68574cef02e2 |
children | ccf5a52730b9 |
comparison
equal
deleted
inserted
replaced
9797:62eb9fe24692 | 9798:255596f41014 |
---|---|
664 transfer_cb(gpointer data, gint source, GaimInputCondition condition) | 664 transfer_cb(gpointer data, gint source, GaimInputCondition condition) |
665 { | 665 { |
666 GaimXferUiOps *ui_ops; | 666 GaimXferUiOps *ui_ops; |
667 GaimXfer *xfer = (GaimXfer *)data; | 667 GaimXfer *xfer = (GaimXfer *)data; |
668 char *buffer = NULL; | 668 char *buffer = NULL; |
669 ssize_t r; | 669 ssize_t r = 0; |
670 | 670 |
671 if (condition & GAIM_INPUT_READ) { | 671 if (condition & GAIM_INPUT_READ) { |
672 r = gaim_xfer_read(xfer, &buffer); | 672 r = gaim_xfer_read(xfer, &buffer); |
673 if (r > 0) { | 673 if (r > 0) { |
674 fwrite(buffer, 1, r, xfer->dest_fp); | 674 fwrite(buffer, 1, r, xfer->dest_fp); |
675 } else if(r < 0) { | 675 } else if(r < 0) { |
676 gaim_xfer_cancel_remote(xfer); | 676 gaim_xfer_cancel_remote(xfer); |
677 return; | 677 return; |
678 } | 678 } |
679 } | 679 } |
680 else { | 680 |
681 if (condition & GAIM_INPUT_WRITE) { | |
681 size_t s = MIN(gaim_xfer_get_bytes_remaining(xfer), 4096); | 682 size_t s = MIN(gaim_xfer_get_bytes_remaining(xfer), 4096); |
682 | 683 |
683 /* this is so the prpl can keep the connection open | 684 /* this is so the prpl can keep the connection open |
684 if it needs to for some odd reason. */ | 685 if it needs to for some odd reason. */ |
685 if (s == 0) { | 686 if (s == 0) { |
686 if(xfer->watcher) { | 687 if (xfer->watcher) { |
687 gaim_input_remove(xfer->watcher); | 688 gaim_input_remove(xfer->watcher); |
688 xfer->watcher = 0; | 689 xfer->watcher = 0; |
689 } | 690 } |
690 return; | 691 return; |
691 } | 692 } |