Quantcast
Channel: Ignite Realtime: Message List
Viewing all articles
Browse latest Browse all 11593

Re: File Transfer fails on Smack 4.1.0-beta 1

$
0
0

I have resolved the issue! After downloading the Smack 4.0.6 source code and debugging the packet parsing on the Receiver side, I found that everything was being done correctly. The IQs and Packets were being parsed, and the XMPPTCPConnection was correctly handling the processing of the packets. The issue turned out to be some kind of race condition. I believe the problem was here:

                          

        // transfer is of type IncomingFileTransfer, created by

        // FileTransferRequet.accept()

        final String fileName = transfer.getFileName();

        transfer.recieveFile(new File(fileName));

        LOG.info("Incoming file transfer: " + fileName);

        LOG.info("Transfer status is: " + transfer.getStatus());

        while (!transfer.isDone())

        {

            final double progress = transfer.getProgress();

            final double progressPercent = progress * 100.0;

            String percComplete = String.format("%1$,.2f", progressPercent);

            LOG.info("Transfer status is: " + transfer.getStatus());

            LOG.info("File transfer is " + percComplete + "% complete");

            Thread.sleep(1000);

        }

For some reason, the while loop was consuming all the cycles and the XMPPTCPConnection was not able to respond to the Open IQs and Data IQs in a timely manner. So I moved the progress monitoring into a new Thread, and everything worked perfectly. For reference, I was using Java version 1.8.0_31 (64-bit) on Mac OS X and also tested on Java version 1.8.0_31 (64-bit) on Windows 7 Professional (64-bit).


Viewing all articles
Browse latest Browse all 11593

Trending Articles