VirtualBox

Changeset 91024 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Aug 31, 2021 9:56:26 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146665
Message:

Audio/Validation Kit: Trying to resolve the connection issues by checking whether clients were connected in reverse mode or not. This would otherwise end up in connecting more and more clients without any real use. See comments. ​bugref:10008

Location:
trunk/src/VBox/Devices/Audio
Files:
4 edited

Legend:

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

    r91023 r91024  
    10021002         * for every new client.
    10031003         */
     1004        bool                fFromServer;
    10041005        PATSTRANSPORTCLIENT pTransportClient;
    1005         rc = pThis->pTransport->pfnWaitForConnect(pThis->pTransportInst, 1000 /* msTimeout */, &pTransportClient);
     1006        rc = pThis->pTransport->pfnWaitForConnect(pThis->pTransportInst, 1000 /* msTimeout */, &fFromServer, &pTransportClient);
    10061007        if (RT_FAILURE(rc))
    10071008            continue;
     
    10321033            LogRelFunc(("Creating new client structure failed with out of memory error\n"));
    10331034            pThis->pTransport->pfnNotifyBye(pThis->pTransportInst, pTransportClient);
     1035            rc = VERR_NO_MEMORY;
     1036            break; /* This is fatal, break out of the loop. */
     1037        }
     1038
     1039        if (RT_SUCCESS(rc))
     1040        {
     1041            LogRelFunc(("New connection established (%s)\n", fFromServer ? "from server" : "as client"));
     1042
     1043            /**
     1044             * If the new client is from a remote server (also called a reverse connection)
     1045             * instead from this server, exit this loop and stop trying to connect to the remote server.
     1046             *
     1047             * Otherwise we would connect lots and lots of clients without any real use.
     1048             *
     1049             ** @todo Improve this handling -- there might be a better / more elegant solution.
     1050             */
     1051            if (fFromServer)
     1052                break;
    10341053        }
    10351054    }
     
    10501069int AudioTestSvcInit(PATSSERVER pThis, PCATSCALLBACKS pCallbacks)
    10511070{
     1071    LogRelFlowFuncEnter();
     1072
    10521073    RT_BZERO(pThis, sizeof(ATSSERVER));
    10531074
     
    10971118        LogRel(("Creating server failed with %Rrc\n", rc));
    10981119
     1120    LogRelFlowFuncLeaveRC(rc);
    10991121    return rc;
    11001122}
  • trunk/src/VBox/Devices/Audio/AudioTestServiceClient.cpp

    r90984 r91024  
    331331    {
    332332        rc = pClient->pTransport->pfnWaitForConnect(pClient->pTransportInst,
    333                                                     msTimeout, &pClient->pTransportClient);
     333                                                    msTimeout, NULL /* pfFromServer */, &pClient->pTransportClient);
    334334        if (RT_SUCCESS(rc))
    335335        {
  • trunk/src/VBox/Devices/Audio/AudioTestServiceInternal.h

    r90962 r91024  
    128128     *                              Use RT_INDEFINITE_WAIT to wait indefinitely.
    129129     *                              This might or might not be supported by the specific transport implementation.
     130     * @param   pfFromServer        Returns \c true if the returned client is from a remote server (called a reverse connection),
     131     *                              or \c false if not (regular client). Optional and can be NULL.
    130132     * @param   ppClientNew         Where to return the allocated client on success.
    131133     */
    132     DECLR3CALLBACKMEMBER(int, pfnWaitForConnect, (PATSTRANSPORTINST pThis, RTMSINTERVAL msTimeout, PPATSTRANSPORTCLIENT ppClientNew));
     134    DECLR3CALLBACKMEMBER(int, pfnWaitForConnect, (PATSTRANSPORTINST pThis, RTMSINTERVAL msTimeout, bool *pfFromServer, PPATSTRANSPORTCLIENT ppClientNew));
    133135
    134136    /**
  • trunk/src/VBox/Devices/Audio/AudioTestServiceTcp.cpp

    r91023 r91024  
    321321 * @interface_method_impl{ATSTRANSPORT,pfnWaitForConnect}
    322322 */
    323 static DECLCALLBACK(int) atsTcpWaitForConnect(PATSTRANSPORTINST pThis,  RTMSINTERVAL msTimeout, PPATSTRANSPORTCLIENT ppClientNew)
     323static DECLCALLBACK(int) atsTcpWaitForConnect(PATSTRANSPORTINST pThis,  RTMSINTERVAL msTimeout,
     324                                              bool *pfFromServer, PPATSTRANSPORTCLIENT ppClientNew)
    324325{
    325326    PATSTRANSPORTCLIENT pClient = (PATSTRANSPORTCLIENT)RTMemAllocZ(sizeof(ATSTRANSPORTCLIENT));
     
    338339        pClient->fFromServer = true;
    339340        rc = RTTcpServerListen2(pThis->pTcpServer, &pClient->hTcpClient);
    340         LogRelFlowFunc(("RTTcpServerListen2 -> %Rrc\n", rc));
     341        LogRelFlowFunc(("RTTcpServerListen2(%RTsock) -> %Rrc\n", pClient->hTcpClient, rc));
    341342    }
    342343    else if (pThis->enmConnMode == ATSCONNMODE_CLIENT)
     
    423424    if (RT_SUCCESS(rc))
    424425    {
     426        if (pfFromServer)
     427            *pfFromServer = pClient->fFromServer;
    425428        *ppClientNew = pClient;
    426429    }
Note: See TracChangeset for help on using the changeset viewer.

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