VirtualBox

Changeset 91012 in vbox for trunk/src


Ignore:
Timestamp:
Aug 30, 2021 7:44:20 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: More (verbose) releasing logging for the TCP transport layer of VKAT. ​bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioTestServiceTcp.cpp

    r90962 r91012  
    131131    if (pClient->hTcpClient != NIL_RTSOCKET)
    132132    {
     133        LogRelFlowFunc(("Disconnecting client %RTsock\n", pClient->hTcpClient));
     134
    133135        int rc;
    134136        if (pClient->fFromServer)
     
    150152 * Sets the current client socket in a safe manner.
    151153 *
    152  * @returns NIL_RTSOCKET if consumed, other wise hTcpClient.
     154 * @returns NIL_RTSOCKET if consumed, otherwise hTcpClient.
    153155 * @param   pThis           Transport instance.
    154156 * @param   pClient         Client to set the socket for.
     
    163165        && !pThis->fStopConnecting)
    164166    {
    165         LogFunc(("New client connected\n"));
     167        LogRelFlowFunc(("New client %RTsock connected (fFromServer=%RTbool)\n", hTcpClient, fFromServer));
    166168
    167169        pClient->fFromServer = fFromServer;
     
    206208    /** @todo Implement cancellation support for using pConnCtx->msTimeout. */
    207209
     210    LogRelFlowFuncEnter();
     211
    208212    RTSOCKET hTcpClient;
    209213    int rc = RTTcpServerListen2(pThis->pTcpServer, &hTcpClient);
     
    214218    }
    215219
     220    LogRelFlowFuncLeaveRC(rc);
    216221    return rc;
    217222}
     
    233238    uint64_t msStartTs = RTTimeMilliTS();
    234239
     240    LogRelFlowFuncEnter();
     241
    235242    for (;;)
    236243    {
     
    259266            && RTTimeMilliTS() - msStartTs >= pConnCtx->msTimeout)
    260267        {
     268            LogRelFlowFunc(("Timed out (%RU32ms)\n", pConnCtx->msTimeout));
    261269            return VERR_TIMEOUT;
    262270        }
     
    265273        RTThreadUserWait(hSelf, 1536);
    266274    }
     275
     276    LogRelFlowFuncLeave();
    267277    return VINF_SUCCESS;
    268278}
     
    279289    int rcRet = VINF_SUCCESS;
    280290
     291    LogRelFlowFuncEnter();
     292
    281293    if (pThis->hThreadConnect != NIL_RTTHREAD)
    282294    {
     
    301313        }
    302314    }
     315
     316    LogRelFlowFuncLeaveRC(rcRet);
    303317    return rcRet;
    304318}
     
    314328    int rc;
    315329
    316     LogFunc(("msTimeout=%RU32, enmConnMode=%#x\n", msTimeout, pThis->enmConnMode));
     330    LogRelFlowFunc(("msTimeout=%RU32, enmConnMode=%#x\n", msTimeout, pThis->enmConnMode));
    317331
    318332    uint64_t msStartTs = RTTimeMilliTS();
     
    324338        pClient->fFromServer = true;
    325339        rc = RTTcpServerListen2(pThis->pTcpServer, &pClient->hTcpClient);
    326         LogFunc(("RTTcpServerListen2 -> %Rrc\n", rc));
     340        LogRelFlowFunc(("RTTcpServerListen2 -> %Rrc\n", rc));
    327341    }
    328342    else if (pThis->enmConnMode == ATSCONNMODE_CLIENT)
     
    331345        for (;;)
    332346        {
    333             Log2Func(("Calling RTTcpClientConnect(%s, %u,)...\n", pThis->szConnectAddr, pThis->uConnectPort));
     347            LogRelFlowFunc(("Calling RTTcpClientConnect(%s, %u,)...\n", pThis->szConnectAddr, pThis->uConnectPort));
    334348            rc = RTTcpClientConnect(pThis->szConnectAddr, pThis->uConnectPort, &pClient->hTcpClient);
    335             LogFunc(("RTTcpClientConnect -> %Rrc\n", rc));
     349            LogRelFlowFunc(("RTTcpClientConnect -> %Rrc\n", rc));
    336350            if (RT_SUCCESS(rc) || atsTcpIsFatalClientConnectStatus(rc))
    337351                break;
     
    422436    }
    423437
     438    if (RT_FAILURE(rc))
     439        LogRelFunc(("Failed with %Rrc\n", rc));
     440
    424441    return rc;
    425442}
     
    430447static DECLCALLBACK(void) atsTcpNotifyReboot(PATSTRANSPORTINST pThis)
    431448{
    432     LogFunc(("RTTcpServerDestroy(%p)\n", pThis->pTcpServer));
     449    LogRelFlowFuncEnter();
    433450    if (pThis->pTcpServer)
    434451    {
    435452        int rc = RTTcpServerDestroy(pThis->pTcpServer);
    436453        if (RT_FAILURE(rc))
    437             LogRel(("RTTcpServerDestroy failed in atsTcpNotifyReboot: %Rrc", rc));
     454            LogRelFunc(("RTTcpServerDestroy failed, rc=%Rrc", rc));
    438455        pThis->pTcpServer = NULL;
    439456    }
     457    LogRelFlowFuncLeave();
    440458}
    441459
     
    475493     * Disconnect the client.
    476494     */
    477     LogFunc(("atsTcpDisconnectClient(%RTsock) (RTTcpWrite rc=%Rrc)\n", pClient->hTcpClient, rc));
     495    LogRelFlowFunc(("atsTcpDisconnectClient(%RTsock) (RTTcpWrite rc=%Rrc)\n", pClient->hTcpClient, rc));
    478496    atsTcpDisconnectClient(pThis, pClient);
    479497}
     
    493511    Log3Func(("%RU32 -> %zu\n", pPktHdr->cb, cbToSend));
    494512
    495     Log3Func(("Header:\n"
    496               "%.*Rhxd\n", RT_MIN(sizeof(ATSPKTHDR), cbToSend), pPktHdr));
     513    LogRelFlowFunc(("Header:\n"
     514                    "%.*Rhxd\n", RT_MIN(sizeof(ATSPKTHDR), cbToSend), pPktHdr));
    497515
    498516    if (cbToSend > sizeof(ATSPKTHDR))
    499         Log3Func(("Payload:\n"
    500                   "%.*Rhxd\n",
    501                   RT_MIN(64, cbToSend - sizeof(ATSPKTHDR)), (uint8_t *)pPktHdr + sizeof(ATSPKTHDR)));
     517        LogRelFlowFunc(("Payload:\n"
     518                        "%.*Rhxd\n",
     519                        RT_MIN(64, cbToSend - sizeof(ATSPKTHDR)), (uint8_t *)pPktHdr + sizeof(ATSPKTHDR)));
    502520
    503521    int rc = RTTcpWrite(pClient->hTcpClient, pPktHdr, cbToSend);
     
    506524    {
    507525        /* assume fatal connection error. */
    508         LogFunc(("RTTcpWrite -> %Rrc -> atsTcpDisconnectClient(%RTsock)\n", rc, pClient->hTcpClient));
     526        LogRelFunc(("RTTcpWrite -> %Rrc -> atsTcpDisconnectClient(%RTsock)\n", rc, pClient->hTcpClient));
    509527        atsTcpDisconnectClient(pThis, pClient);
    510528    }
     
    561579        if (cbRead == 0)
    562580        {
    563             LogFunc(("RTTcpRead -> %Rrc / cbRead=0 -> VERR_NET_NOT_CONNECTED (#1)\n", rc));
     581            LogRelFunc(("RTTcpRead -> %Rrc / cbRead=0 -> VERR_NET_NOT_CONNECTED (#1)\n", rc));
    564582            rc = VERR_NET_NOT_CONNECTED;
    565583            break;
     
    601619                    if (cbRead == 0)
    602620                    {
    603                         LogFunc(("RTTcpRead -> %Rrc / cbRead=0 -> VERR_NET_NOT_CONNECTED (#2)\n", rc));
     621                        LogRelFunc(("RTTcpRead -> %Rrc / cbRead=0 -> VERR_NET_NOT_CONNECTED (#2)\n", rc));
    604622                        rc = VERR_NET_NOT_CONNECTED;
    605623                        break;
     
    609627                }
    610628
    611                 Log3Func(("Header:\n"
    612                           "%.*Rhxd\n", sizeof(ATSPKTHDR), pbData));
     629                LogRelFlowFunc(("Header:\n"
     630                                "%.*Rhxd\n", sizeof(ATSPKTHDR), pbData));
    613631
    614632                if (   RT_SUCCESS(rc)
    615633                    && cbData > sizeof(ATSPKTHDR))
    616                     Log3Func(("Payload:\n"
    617                               "%.*Rhxd\n", RT_MIN(64, cbData - sizeof(ATSPKTHDR)), (uint8_t *)pbData + sizeof(ATSPKTHDR)));
     634                    LogRelFlowFunc(("Payload:\n"
     635                                    "%.*Rhxd\n", RT_MIN(64, cbData - sizeof(ATSPKTHDR)), (uint8_t *)pbData + sizeof(ATSPKTHDR)));
    618636            }
    619637        }
     
    643661
    644662            /* assume fatal connection error. */
    645             LogFunc(("RTTcpRead -> %Rrc -> atsTcpDisconnectClient(%RTsock)\n", rc, pClient->hTcpClient));
     663            LogRelFunc(("RTTcpRead -> %Rrc -> atsTcpDisconnectClient(%RTsock)\n", rc, pClient->hTcpClient));
    646664            atsTcpDisconnectClient(pThis, pClient);
    647665        }
     
    684702static DECLCALLBACK(void) atsTcpTerm(PATSTRANSPORTINST pThis)
    685703{
     704    LogRelFlowFuncEnter();
     705
    686706    /* Signal thread */
    687707    if (RTCritSectIsInitialized(&pThis->CritSect))
     
    701721    if (pThis->pTcpServer)
    702722    {
    703         LogFunc(("Destroying server...\n"));
     723        LogRelFlowFunc(("Destroying server...\n"));
    704724        int rc = RTTcpServerDestroy(pThis->pTcpServer);
    705725        if (RT_FAILURE(rc))
    706             LogRel(("RTTcpServerDestroy failed in atsTcpTerm: %Rrc", rc));
     726            LogRelFunc(("RTTcpServerDestroy failed with %Rrc", rc));
    707727        pThis->pTcpServer        = NULL;
    708728    }
     
    711731    atsTcpConnectWaitOnThreads(pThis, 15000);
    712732
    713     LogFunc(("Done\n"));
     733    LogRelFlowFuncLeave();
    714734}
    715735
     
    759779            if (rc == VERR_NET_DOWN)
    760780            {
    761                 LogRel2(("RTTcpServerCreateEx(%s, %u,) failed: %Rrc, retrying for 20 seconds...\n",
    762                          pThis->szBindAddr[0] ? pThis->szBindAddr : NULL, pThis->uBindPort, rc));
     781                LogRelFunc(("RTTcpServerCreateEx(%s, %u,) failed: %Rrc, retrying for 20 seconds...\n",
     782                            pThis->szBindAddr[0] ? pThis->szBindAddr : NULL, pThis->uBindPort, rc));
    763783                uint64_t StartMs = RTTimeMilliTS();
    764784                do
     
    769789                         && RTTimeMilliTS() - StartMs < 20000);
    770790                if (RT_SUCCESS(rc))
    771                     LogRel2(("RTTcpServerCreateEx succceeded\n"));
     791                    LogRelFunc(("RTTcpServerCreateEx succceeded\n"));
    772792            }
    773793
    774794            if (RT_FAILURE(rc))
    775795            {
    776                 LogRel(("RTTcpServerCreateEx(%s, %u,) failed: %Rrc\n",
    777                         pThis->szBindAddr[0] ? pThis->szBindAddr : NULL, pThis->uBindPort, rc));
     796                LogRelFunc(("RTTcpServerCreateEx(%s, %u,) failed: %Rrc\n",
     797                            pThis->szBindAddr[0] ? pThis->szBindAddr : NULL, pThis->uBindPort, rc));
    778798            }
    779799        }
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