VirtualBox

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


Ignore:
Timestamp:
Nov 24, 2009 12:30:13 PM (15 years ago)
Author:
vboxsync
Message:

SSM: Flush buffers when they are 0.5 sec old and check that the stream is ok (hasn't been cancelled). Check for out of disk space before each write.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImplTeleporter.cpp

    r24878 r24895  
    285285    AssertReturn(pState->mfIsSource, VERR_INVALID_HANDLE);
    286286
    287     /* Poll for incoming NACKs and errors from the other side */
    288     int rc = RTTcpSelectOne(pState->mhSocket, 0);
    289     if (rc != VERR_TIMEOUT)
    290     {
    291         if (RT_SUCCESS(rc))
    292         {
    293             LogRel(("Teleporter/TCP: Incoming data found before write, assuming it's a cancel.\n"));
    294             rc = VERR_SSM_CANCELLED;
    295         }
    296         else
    297             LogRel(("Teleporter/TCP: RTTcpSelectOne -> %Rrc before write.\n", rc));
    298         return rc;
    299     }
    300 
    301287    for (;;)
    302288    {
     
    305291        Hdr.u32Magic = TELEPORTERTCPHDR_MAGIC;
    306292        Hdr.cb       = RT_MIN((uint32_t)cbToWrite, TELEPORTERTCPHDR_MAX_SIZE);
    307         rc = RTTcpWrite(pState->mhSocket, &Hdr, sizeof(Hdr));
     293        int rc = RTTcpWrite(pState->mhSocket, &Hdr, sizeof(Hdr));
    308294        if (RT_FAILURE(rc))
    309295        {
     
    483469
    484470/**
     471 * @copydoc SSMSTRMOPS::pfnIsOk
     472 */
     473static DECLCALLBACK(int) teleporterTcpOpIsOk(void *pvUser)
     474{
     475    TeleporterState *pState = (TeleporterState *)pvUser;
     476
     477    if (pState->mfIsSource)
     478    {
     479        /* Poll for incoming NACKs and errors from the other side */
     480        int rc = RTTcpSelectOne(pState->mhSocket, 0);
     481        if (rc != VERR_TIMEOUT)
     482        {
     483            if (RT_SUCCESS(rc))
     484            {
     485                LogRel(("Teleporter/TCP: Incoming data detect by IsOk, assuming it's a cancel.\n"));
     486                rc = VERR_SSM_CANCELLED;
     487            }
     488            else
     489                LogRel(("Teleporter/TCP: RTTcpSelectOne -> %Rrc (IsOk).\n", rc));
     490            return rc;
     491        }
     492    }
     493
     494    return VINF_SUCCESS;
     495}
     496
     497
     498/**
    485499 * @copydoc SSMSTRMOPS::pfnClose
    486500 */
     
    522536    teleporterTcpOpTell,
    523537    teleporterTcpOpSize,
     538    teleporterTcpOpIsOk,
    524539    teleporterTcpOpClose,
    525540    SSMSTRMOPS_VERSION
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