bug in libpurple/ft.c

Sulabh Mahajan sulabh.dev at gmail.com
Sun Jan 25 08:49:39 EST 2009


Hello,

I have been trying to complete a certain part of p2p file transfers for
yahoo protocol for long time. When we receive file, it always used to get
stuck just after the file has been completely transfered. I noticed that the
cause might be in libpurple rather than the code in yahoo.

Please let me know if I am wrong here, or if this could be done through the
protocol code without touching libpurple.

in libpurple/ft.c, in the function purple_xfer_read(), when the if condition
"xfer->ops.read != NULL" holds true, even after completely reading the file,
the function purple_xfer_set_completed() isnt called. This results in the
transfer being stuck after the file is completely obtained.

the function has structure :

gssize purple_xfer_read(PurpleXfer *xfer, guchar **buffer)       {
        .........
        if (xfer->ops.read != NULL)
                r = (xfer->ops.read)(buffer, xfer);
        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);
                ........
        }
        ........
}

It should rather be:

gssize purple_xfer_read(PurpleXfer *xfer, guchar **buffer)       {
        .........
        if (xfer->ops.read != NULL)
                r = (xfer->ops.read)(buffer, xfer);
        else        {
                ........
        }
        ........
        if(r>=0)
                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);
        ........
}

Please let me know if I am wrong here,

Thanks,

Sulabh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20090125/e8476776/attachment.html>


More information about the Devel mailing list