VirtualBox

Changeset 23721 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 13, 2009 1:04:29 PM (15 years ago)
Author:
vboxsync
Message:

Main/LiveMigration: Make sure the end-of-stream marker is read before ACK'ing the load command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl-LiveMigration.cpp

    r23719 r23721  
    166166
    167167    AssertReturn(cchBuf > 1, VERR_INTERNAL_ERROR);
    168 
    169     /* dead simple (stupid) approach. */
     168    *pszBuf = '\0';
     169
     170    /* dead simple approach. */
    170171    for (;;)
    171172    {
     
    174175        if (RT_FAILURE(rc))
    175176        {
    176             *pszBuf = '\0';
    177177            LogRel(("Migration: RTTcpRead -> %Rrc while reading string ('%s')\n", rc, pszStart));
    178178            return rc;
     
    180180        if (    ch == '\n'
    181181            ||  ch == '\0')
    182         {
    183             *pszBuf = '\0';
    184182            return VINF_SUCCESS;
    185         }
    186183        if (cchBuf <= 1)
    187184        {
    188             *pszBuf = '\0';
    189185            LogRel(("Migration: String buffer overflow: '%s'\n", pszStart));
    190186            return VERR_BUFFER_OVERFLOW;
    191187        }
    192188        *pszBuf++ = ch;
     189        *pszBuf = '\0';
    193190        cchBuf--;
    194191    }
     
    953950            }
    954951
     952            /* The EOS might not have been read, make sure it is. */
     953            pState->mfStopReading = false;
     954            size_t cbRead;
     955            vrc = migrationTcpOpRead(pvUser, pState->moffStream, szCmd, 1, &cbRead);
     956            if (vrc != VERR_EOF)
     957            {
     958                LogRel(("Migration: Draining migrationTcpOpRead -> %Rrc\n", vrc));
     959                migrationTcpWriteNACK(pState, vrc);
     960                break;
     961            }
     962
    955963            vrc = migrationTcpWriteACK(pState);
    956964            if (RT_FAILURE(vrc))
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