[Pidgin] #16001: Duplicate calls to purple_xfer_set_bytes_sent()

Pidgin trac at pidgin.im
Mon Feb 17 02:22:15 EST 2014

#16001: Duplicate calls to purple_xfer_set_bytes_sent()
 Reporter:  MarkDoliner  |      Owner:  tomkiewicz
     Type:  defect       |     Status:  new
Milestone:  3.0.0        |  Component:  libpurple
  Version:  3.0.0hg      |   Keywords:
 The newly-added purple_xfer_write_file() and purple_xfer_read_file()
 functions in libpurple/xfer.c include calls to

 There are two problems with this:
 1. The write_file and read_file() functions deal with writing and reading
 a local file on disk, however bytes_sent is intended to represent the
 number of bytes sent or receiver over the network from the peer. Therefore
 it's conceptually wrong for these functions to alter bytes_sent.

 2. The do_transfer() function in libpurple/xfer.c ALSO calls
 purple_xfer_set_bytes_sent(). It does this after calling the write_file
 and read_file functions, which means bytes_sent gets incremented TWICE.

 It seems clear to me that purple_xfer_write_file() and
 purple_xfer_read_file() shouldn't call purple_xfer_set_bytes_sent(). But
 purple_xfer_write_file and purple_xfer_read_file() are called from places
 other than do_transfer(). Will removing the calls to
 purple_xfer_set_bytes_sent() cause problem for those places? I don't know
 --we should check.

Ticket URL: <https://developer.pidgin.im/ticket/16001>
Pidgin <https://pidgin.im>

More information about the Tracker mailing list