VirtualBox

Changeset 3957 in vbox for trunk/src


Ignore:
Timestamp:
Aug 1, 2007 11:18:38 AM (17 years ago)
Author:
vboxsync
Message:

2142: GUI should download Additions:

  1. Protection against double kill requests (this rare issue is possible due to all the http requests are asynchronized and the http-errors could be processed during the user's cancel-operation).
  2. Bug fixed: If the network connection is closed during VM is running just before the Guest Additions download requested, the download procedure will hung & never notifies the user about the network connection is not available. 5 sec timer installed into the download request.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r3951 r3957  
    220220        , mProgressBar (0), mCancelButton (0)
    221221        , mAction (aAction), mStatus (0)
     222        , mConnectDone (false), mSuicide (false)
    222223    {
    223224        /* Disable Install Guest Additions action */
     
    266267
    267268        /* Try to get the required file for the information */
    268         mHttp->get (mPath + mFile);
     269        getFile();
    269270    }
    270271
     
    286287    void processProgress (int aRead, int aTotal)
    287288    {
     289        mConnectDone = true;
    288290        if (aTotal != -1)
    289291        {
     
    311313        if (aError && mHttp->error() != QHttp::Aborted)
    312314        {
     315            mConnectDone = true;
    313316            QString reason = mIsChecking ?
    314317                tr ("Could not connect to the server (%1).") :
     
    346349    }
    347350
     351    /* This slot is used to control the connection timeout. */
     352    void processTimeout()
     353    {
     354        if (mConnectDone) return;
     355        mHttp->abort();
     356        abortDownload (tr ("The download process has been cancelled "
     357                           "due to connection timeout."));
     358    }
     359
    348360    /* This slot is used to process cancel-button clicking signal. */
    349361    void processAbort()
    350362    {
     363        mConnectDone = true;
    351364        mHttp->abort();
    352365        abortDownload (tr ("The download process has been cancelled "
     
    366379private:
    367380
     381    /* This function is used to make a request to get a file */
     382    void getFile()
     383    {
     384        mConnectDone = false;
     385        mHttp->get (mPath + mFile);
     386        QTimer::singleShot (5000, this, SLOT (processTimeout()));
     387    }
     388
    368389    /* This function is used to ask the user about he wants to download the
    369390     * founded Guest Additions image or not. It also shows the progress-bar
     
    377398        {
    378399            mIsChecking = false;
    379             mHttp->get (mPath + mFile);
     400            getFile();
    380401        }
    381402        else
     
    388409    void abortDownload (const QString &aReason)
    389410    {
     411        /* Protect against double kill request. */
     412        if (mSuicide) return;
     413        mSuicide = true;
     414
    390415        vboxProblem().cannotDownloadGuestAdditions (mProtocol + mHost +
    391416                                                    mPath + mFile, aReason);
     
    405430    QAction *mAction;
    406431    int mStatus;
     432    bool mConnectDone;
     433    bool mSuicide;
    407434};
    408435
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette