src/ft.c

changeset 9798
9da203982089
parent 9796
dd7499147bed
child 9805
440c01e927ae
equal deleted inserted replaced
9797:b69f82378b7b 9798:9da203982089
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 }

mercurial