[Pidgin] #814: Fix: self-canceling file transfer

Pidgin trac at pidgin.im
Mon May 28 07:35:57 EDT 2007


#814: Fix: self-canceling file transfer
------------------------+---------------------------------------------------
  Reporter:  vampire    |       Owner:  datallah    
      Type:  patch      |      Status:  closed      
  Priority:  minor      |   Milestone:  2.0.1       
 Component:  libpurple  |     Version:  2.0         
Resolution:  fixed      |    Keywords:  filetransfer
   Pending:  0          |  
------------------------+---------------------------------------------------
Comment (by rafaelfc1208):

 Hello,

 I'm using latest libPurple 2.0.1 from Monotone on my own win32 app, but
 the "self-canceling file transfer" problem fixed and explained at
 http://developer.pidgin.im/ticket/814, still have some problems using
 Jabber protocol.

 I have noted on file transfer at last call of wpurple_read (located in
 libpurple/win32/libc_interface.c) at almost 100% completed (but not ended
 yet), the "ret" variable is zero, although "size" is 495.

 (...)

 {{{
 int wpurple_read(int fd, void *buf, unsigned int size) {
 int ret;

 if(wpurple_is_socket(fd)) {
 if((ret = recv(fd, buf, size, 0)) == SOCKET_ERROR) { <== HERE
 errno = WSAGetLastError();
 if(errno == WSAEWOULDBLOCK)
 errno = EAGAIN;
 return -1;
 }
 }}}
  (...)

 When "ret" is zero the return of method read(xfer->fd, *buffer, s)
 (located in "libpurple/ft.c") is zero, causing
 ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer)) get
 false and setting r = -1.

 (...)

 {{{
 r = read(xfer->fd, *buffer, s);
 if (r < 0 && errno == EAGAIN)
 r = 0;
 else if (r < 0)
 r = -1;
 else if ((purple_xfer_get_size(xfer) > 0) &&
 ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer)))
 purple_xfer_set_completed(xfer, TRUE);
 else if (r == 0)
 r = -1; <== HERE
 }}}

 (...)

 The result of this is self-canceling file transfer at 100%.

 I think I found the cause of this problem, but I have no idea how to fix
 it. Or I'm completely wrong and confused about file transfer.

 Thanks.

 Best regards.

 I worte this question on "Users Helping Users" forum, then Daniel Atallah
 said:

 By: Daniel Atallah (datallah) - 2007-05-25 19:15
 This really should go to the devel mailing list not here - we generally
 don't look at this forum.

 I guess my question is "If it had already read the full file previously,
 why wasn't it marked as completed already and why didn't it stop reading?

-- 
Ticket URL: <http://developer.pidgin.im/ticket/814#comment:9>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list