VirtualBox

Changeset 16540 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 6, 2009 3:51:51 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
42474
Message:

NAT:decoupling of drvNATSend

Location:
trunk/src/VBox/Devices/Network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r16448 r16540  
    158158# ifndef VBOX_WITH_SLIRP_MT
    159159    rc = RTReqAlloc(pThis->pReqQueue, &pReq, RTREQTYPE_INTERNAL);
    160     buf = pvBuf;
    161160# else
    162     buf = (const void *)RTMemAlloc(cb);
    163     memcpy((void *)buf, pvBuf, cb);
    164161    rc = RTReqAlloc((PRTREQQUEUE)slirp_get_queue(pThis->pNATState), &pReq, RTREQTYPE_INTERNAL);
    165162# endif
    166163    AssertReleaseRC(rc);
     164
     165    /* @todo: Here we should get mbuf instead temporal buffer */
     166    buf = (const void *)RTMemAlloc(cb);
     167    if (buf == NULL)
     168    {
     169        LogRel(("Can't allocate buffer for sending buffer\n"));
     170        return VERR_NO_MEMORY;
     171    }
     172    memcpy((void *)buf, pvBuf, cb);
     173
    167174    pReq->u.Internal.pfn      = (PFNRT)drvNATSendWorker;
    168175    pReq->u.Internal.cArgs    = 3;
     
    170177    pReq->u.Internal.aArgs[1] = (uintptr_t)buf;
    171178    pReq->u.Internal.aArgs[2] = (uintptr_t)cb;
    172 # ifndef VBOX_WITH_SLIRP_MT
    173     pReq->fFlags              = RTREQFLAGS_VOID;
    174 # else
    175179    pReq->fFlags              = RTREQFLAGS_VOID|RTREQFLAGS_NO_WAIT;
    176 # endif
    177180
    178181    rc = RTReqQueue(pReq, 0); /* don't wait, we have to wakeup the NAT thread fist */
    179 #ifndef VBOX_WITH_SLIRP_MT
    180     if (RT_LIKELY(rc == VERR_TIMEOUT))
    181     {
     182    AssertReleaseRC(rc);
    182183# ifndef RT_OS_WINDOWS
    183         /* kick select() */
    184         rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL);
    185         AssertRC(rc);
    186 # else
    187         /* kick WSAWaitForMultipleEvents */
    188         rc = WSASetEvent(pThis->hWakeupEvent);
    189         AssertRelease(rc == TRUE);
    190 # endif
    191         rc = RTReqWait(pReq, RT_INDEFINITE_WAIT);
    192         AssertReleaseRC(rc);
    193     }
    194     else
    195         AssertReleaseRC(rc);
    196     RTReqFree(pReq);
    197 #else
    198 # ifndef RT_OS_WINDOWS
    199         /* kick select() */
     184    /* kick select() */
    200185    rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL);
    201186    AssertRC(rc);
     
    205190    AssertRelease(rc == TRUE);
    206191# endif
    207     AssertReleaseRC(rc);
    208 #endif
    209192
    210193#else /* !VBOX_WITH_SIMPLIFIED_SLIRP_SYNC */
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r16511 r16540  
    12381238            break;
    12391239    }
     1240    RTMemFree(pkt);
    12401241}
    12411242
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