VirtualBox

Ignore:
Timestamp:
Jul 20, 2023 1:43:35 PM (17 months ago)
Author:
vboxsync
Message:

Shared Clipboard: Reduced replying to status messages from the host, as those are not needed in (most) cases. The rest is documented. bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp

    r100663 r100666  
    21222122    LogFlowFuncEnter();
    21232123
    2124     int rc;
     2124    int rc = VINF_SUCCESS;
    21252125
    21262126    PSHCLTRANSFER pTransfer = ShClTransferCtxGetTransferById(pTransferCtx, idTransfer);
     
    21332133        if (RT_SUCCESS(rc))
    21342134        {
    2135             LogRel(("Shared Clipboard: Transfer %RU32 successfully uninitialized\n", idTransfer));
     2135            LogRel(("Shared Clipboard: Transfer %RU16 successfully uninitialized\n", idTransfer));
    21362136        }
    21372137        else
    2138             LogRel(("Shared Clipboard: Unable to uninitialized transfer %RU32, rc=%Rrc\n", idTransfer, rc));
    2139     }
    2140     else
    2141         rc = VERR_SHCLPB_TRANSFER_ID_NOT_FOUND;
    2142 
    2143     /* Send a reply in any case. */
    2144     int rc2 = VbglR3ClipboardTransferSendStatus(pCmdCtx, pTransfer,
    2145                                                   RT_SUCCESS(rc)
    2146                                                 ? SHCLTRANSFERSTATUS_UNINITIALIZED : SHCLTRANSFERSTATUS_ERROR, rc);
    2147 
    2148     /* The host might not have the transfer around anymore at this time, so simply ignore this error. */
    2149     if (rc2 == VERR_SHCLPB_TRANSFER_ID_NOT_FOUND)
    2150         rc2 = VINF_SUCCESS;
    2151 
    2152     if (RT_SUCCESS(rc))
    2153         rc = rc2;
     2138            LogRel(("Shared Clipboard: Unable to uninitialized transfer %RU16, rc=%Rrc\n", idTransfer, rc));
     2139    }
    21542140
    21552141    LogFlowFuncLeaveRC(rc);
     
    22132199                                                  RT_SUCCESS(rc)
    22142200                                                ? SHCLTRANSFERSTATUS_STARTED : SHCLTRANSFERSTATUS_ERROR, rc);
    2215     if (RT_SUCCESS(rc))
    2216         rc = rc2;
    2217 
    2218     LogFlowFuncLeaveRC(rc);
    2219     return rc;
    2220 }
    2221 
    2222 /**
    2223  * Stops a transfer on the guest side.
    2224  *
    2225  * @returns VBox status code, or VERR_NOT_FOUND if transfer has not been found.
    2226  * @param   pCmdCtx             Command context to use.
    2227  * @param   pTransferCtx        Transfer context to stop transfer for.
    2228  * @param   uTransferID         ID of transfer to stop.
    2229  */
    2230 static int vbglR3ClipboardTransferStop(PVBGLR3SHCLCMDCTX pCmdCtx, PSHCLTRANSFERCTX pTransferCtx,
    2231                                        SHCLTRANSFERID uTransferID)
    2232 {
    2233     LogFlowFuncEnter();
    2234 
    2235     int rc;
    2236 
    2237     PSHCLTRANSFER pTransfer = ShClTransferCtxGetTransferById(pTransferCtx, uTransferID);
    2238     if (pTransfer)
    2239     {
    2240         rc = ShClTransferCtxUnregisterById(pTransferCtx, uTransferID);
    2241         if (RT_SUCCESS(rc))
    2242         {
    2243             LogRel(("Shared Clipboard: Transfer %RU32 successfully stopped\n", uTransferID));
    2244         }
    2245         else
    2246             LogRel(("Shared Clipboard: Unable to stop transfer %RU32, rc=%Rrc\n", uTransferID, rc));
    2247     }
    2248     else
    2249         rc = VERR_SHCLPB_TRANSFER_ID_NOT_FOUND;
    2250 
    2251     /* Send a reply in any case. */
    2252     int rc2 = VbglR3ClipboardTransferSendStatus(pCmdCtx, pTransfer,
    2253                                                   RT_SUCCESS(rc)
    2254                                                 ? SHCLTRANSFERSTATUS_COMPLETED : SHCLTRANSFERSTATUS_ERROR, rc);
    22552201    if (RT_SUCCESS(rc))
    22562202        rc = rc2;
     
    23762322                        }
    23772323
    2378                         case SHCLTRANSFERSTATUS_UNINITIALIZED:
    2379                         {
    2380                             rc = vbglR3ClipboardTransferDestroy(pCmdCtx, pTransferCtx, idTransfer);
    2381                             break;
    2382                         }
    2383 
    23842324                        case SHCLTRANSFERSTATUS_STARTED:
    23852325                        {
     
    23882328                        }
    23892329
     2330                        case SHCLTRANSFERSTATUS_UNINITIALIZED:
     2331                            RT_FALL_THROUGH();
    23902332                        case SHCLTRANSFERSTATUS_COMPLETED:
    23912333                            RT_FALL_THROUGH();
     
    23962338                        case SHCLTRANSFERSTATUS_ERROR:
    23972339                        {
    2398                             rc = vbglR3ClipboardTransferStop(pCmdCtx, pTransferCtx, idTransfer);
     2340                            rc = vbglR3ClipboardTransferDestroy(pCmdCtx, pTransferCtx, idTransfer);
    23992341                            break;
    24002342                        }
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