VirtualBox

Changeset 30426 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 24, 2010 12:25:24 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63060
Message:

NAT: small performance enhancement. (allocate mbuf if it's required).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/sbuf.c

    r30425 r30426  
    145145     * ottherwise it'll arrive out of order, and hence corrupt
    146146     */
    147     buf = RTMemAlloc(mlen);
    148     if (buf == NULL)
    149     {
    150         ret = 0;
    151         goto no_sent;
    152     }
    153     m_copydata(m, 0, mlen, buf);
     147    if (m->m_next)
     148    {
     149        buf = RTMemAlloc(mlen);
     150        if (buf == NULL)
     151        {
     152            ret = 0;
     153            goto no_sent;
     154        }
     155        m_copydata(m, 0, mlen, buf);
     156    }
     157    else
     158        buf = mtod(m, char *);
     159
    154160    if(!so->so_rcv.sb_cc)
    155161        ret = send(so->s, buf, mlen, 0);
    156     RTMemFree(buf);
     162
     163    if (m->m_next)
     164        RTMemFree(buf);
    157165no_sent:
    158166
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