comparison src/ft.c @ 13786:5ddde4ad1ca2

[gaim-migrate @ 16198] Fix some places where a closed socket isn't being dealt with correctly. This may be the cause of the high CPU usage that some people have noticed. Most of these were reported by Eduardo Prez. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 26 May 2006 03:26:03 +0000
parents 4b6308145fcd
children 9af607a0108f
comparison
equal deleted inserted replaced
13785:10f702a4d3dc 13786:5ddde4ad1ca2
792 else if (r < 0) 792 else if (r < 0)
793 r = -1; 793 r = -1;
794 else if ((gaim_xfer_get_size(xfer) > 0) && 794 else if ((gaim_xfer_get_size(xfer) > 0) &&
795 ((gaim_xfer_get_bytes_sent(xfer)+r) >= gaim_xfer_get_size(xfer))) 795 ((gaim_xfer_get_bytes_sent(xfer)+r) >= gaim_xfer_get_size(xfer)))
796 gaim_xfer_set_completed(xfer, TRUE); 796 gaim_xfer_set_completed(xfer, TRUE);
797 else if (r == 0)
798 r = -1;
797 } 799 }
798 800
799 return r; 801 return r;
800 } 802 }
801 803
833 835
834 if (condition & GAIM_INPUT_READ) { 836 if (condition & GAIM_INPUT_READ) {
835 r = gaim_xfer_read(xfer, &buffer); 837 r = gaim_xfer_read(xfer, &buffer);
836 if (r > 0) { 838 if (r > 0) {
837 fwrite(buffer, 1, r, xfer->dest_fp); 839 fwrite(buffer, 1, r, xfer->dest_fp);
838 } else if(r < 0) { 840 } else if(r <= 0) {
839 gaim_xfer_cancel_remote(xfer); 841 gaim_xfer_cancel_remote(xfer);
840 return; 842 return;
841 } 843 }
842 } 844 }
843 845