Ticket #91 (new defect)

Opened 11 years ago

Last modified 11 years ago

xuvtools: [wishlist] Reduce the cpu usage for the ftp uploader

Reported by: aaron@… Owned by: emmenlau
Priority: minor Milestone:
Component: xuvtools Version:
Keywords: xuvtools, xuvtools_gui, ftp, upload, cpu Cc: developer@…

Description

Current code:

(...)
QUrl url( "ftp://example.com" );
ftp->connectToHost( url.host( ), url.port( 21 ) );
ftp->login( "anonymous", "" );
 
// Put all the ftp commands you need
 
ftp->close( );
    
// Process the queue of ftp events
while ( ( ftp->hasPendingCommands( ) ) || ( ftp->currentCommand( ) != QFtp::None ) )
        qApp->processEvents( );

Suggested alternative (from a reply on my post on qtcentre.org/forum):

"Your code will use 100% CPU. A better solution is to use a QEventLoop and connect the QFtp done() signal to the quit() of the QEventLoop. Then you can just start the QFtp and then run eventLoop.exec()."

Change History

Changed 11 years ago by emmenlau

  • cc developer@… added
  • keywords xuvtools, xuvtools_gui, ftp, upload, cpu added
  • summary changed from Reduce the cpu usage for the ftp uploader to xuvtools: [wishlist] Reduce the cpu usage for the ftp uploader
Note: See TracTickets for help on using tickets.