VirtualBox

Ignore:
Timestamp:
Dec 9, 2020 2:53:08 PM (4 years ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfers: More code for HTTP instance creation / destruction. bugref:9874

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-http.cpp

    r87067 r87068  
    182182}
    183183
     184/**
     185 * Destroys a Shared Clipboard HTTP server instance, internal version.
     186 *
     187 * @returns VBox status code.
     188 * @param   pSrv                Shared Clipboard HTTP server instance to destroy.
     189 */
    184190int shClTransferHttpServerDestroyInternal(PSHCLHTTPSERVER pSrv)
    185191{
     
    195201    RTHttpServerResponseDestroy(&pSrv->Resp);
    196202
     203    pSrv->hHTTPServer = NIL_RTHTTPSERVER;
     204
    197205    return RTCritSectDelete(&pSrv->CritSect);
    198206}
    199207
     208/**
     209 * Locks the critical section of a Shared Clipboard HTTP server instance.
     210 *
     211 * @param   pSrv                Shared Clipboard HTTP server instance to lock.
     212 */
    200213DECLINLINE(void) shClTransferHttpServerLock(PSHCLHTTPSERVER pSrv)
    201214{
     
    204217}
    205218
     219/**
     220 * Unlocks the critical section of a Shared Clipboard HTTP server instance.
     221 *
     222 * @param   pSrv                Shared Clipboard HTTP server instance to unlock.
     223 */
    206224DECLINLINE(void) shClTransferHttpServerUnlock(PSHCLHTTPSERVER pSrv)
    207225{
     
    209227    AssertRC(rc2);
    210228}
    211 
    212 
    213 /*********************************************************************************************************************************
    214 *   Public functions                                                                                                             *
    215 *********************************************************************************************************************************/
    216229
    217230/**
     
    230243}
    231244
     245
     246/*********************************************************************************************************************************
     247*   Public functions                                                                                                             *
     248*********************************************************************************************************************************/
     249
     250/**
     251 * Initializes a new Shared Clipboard HTTP server instance.
     252 *
     253 * @param   pSrv                HTTP server instance to initialize.
     254 */
     255void ShClTransferHttpServerInit(PSHCLHTTPSERVER pSrv)
     256{
     257    AssertPtrReturnVoid(pSrv);
     258
     259    shClTransferHttpServerInitInternal(pSrv);
     260}
     261
    232262/**
    233263 * Creates a new Shared Clipboard HTTP server instance, extended version.
     
    240270{
    241271    AssertPtrReturn(pSrv, VERR_INVALID_POINTER);
    242 
    243     shClTransferHttpServerInitInternal(pSrv);
    244272
    245273    RTHTTPSERVERCALLBACKS Callbacks;
     
    374402            AssertReturn(cch, VERR_BUFFER_OVERFLOW);
    375403
     404            pSrvTx->pTransfer = pTransfer;
     405
    376406            RTListAppend(&pSrv->lstTransfers, &pSrvTx->Node);
    377 
    378407            pSrv->cTransfers++;
     408
     409            LogFunc(("pTransfer=%p, idTransfer=%RU16, szPath=%s -> %RU32 transfers\n",
     410                     pSrvTx->pTransfer, pSrvTx->pTransfer->State.uID, pSrvTx->szPathVirtual, pSrv->cTransfers));
     411
     412            LogRel2(("Shared Clipboard: Registered HTTP transfer %RU16, now %RU32 HTTP transfers total\n",
     413                     pTransfer->State.uID, pSrv->cTransfers));
    379414        }
    380415    }
     
    385420    shClTransferHttpServerUnlock(pSrv);
    386421
     422    LogFlowFuncLeaveRC(rc);
    387423    return rc;
    388424}
     
    403439
    404440    AssertReturn(pSrv->cTransfers, VERR_WRONG_ORDER);
     441
     442    int rc = VINF_SUCCESS;
    405443
    406444    PSHCLHTTPSERVERTRANSFER pSrvTx;
     
    418456            pSrv->cTransfers--;
    419457
    420             shClTransferHttpServerUnlock(pSrv);
    421             return VINF_SUCCESS;
     458            LogFunc(("pTransfer=%p, idTransfer=%RU16, szPath=%s -> %RU32 transfers\n",
     459                     pSrvTx->pTransfer, pSrvTx->pTransfer->State.uID, pSrvTx->szPathVirtual, pSrv->cTransfers));
     460
     461            LogRel2(("Shared Clipboard: Unregistered HTTP transfer %RU16, now %RU32 HTTP transfers total\n",
     462                     pTransfer->State.uID, pSrv->cTransfers));
     463
     464            rc = VINF_SUCCESS;
     465            break;
    422466        }
    423467    }
    424468
    425469    shClTransferHttpServerUnlock(pSrv);
    426     return VERR_NOT_FOUND;
     470
     471    LogFlowFuncLeaveRC(rc);
     472    return rc;
    427473}
    428474
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