VirtualBox

Changeset 39430 in vbox


Ignore:
Timestamp:
Nov 28, 2011 8:25:42 AM (13 years ago)
Author:
vboxsync
Message:

NAT: logging (correct socket state printing).

File:
1 edited

Legend:

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

    r39363 r39430  
    324324    uint32_t u32SocketState = (uint32_t)(uintptr_t)pvValue;
    325325    int idxNATState = 0;
     326    bool fFirst = true;
     327    size_t cbReturn = 0;
    326328    NOREF(cchWidth);
    327329    NOREF(cchPrecision);
     
    332334    for (idxNATState = 0; idxNATState < RT_ELEMENTS(g_apszSocketStates); ++idxNATState)
    333335    {
    334         if (u32SocketState == g_apszSocketStates[idxNATState].u32SocketState)
    335             return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, g_apszSocketStates[idxNATState].pcszSocketStateName);
    336     }
    337     return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[unknown state %RX32]", u32SocketState);
     336        if (u32SocketState & g_apszSocketStates[idxNATState].u32SocketState)
     337        {
     338            if (fFirst)
     339            {
     340                cbReturn += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, g_apszSocketStates[idxNATState].pcszSocketStateName);
     341                fFirst = false;
     342            }
     343            else
     344                cbReturn += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "|%s", g_apszSocketStates[idxNATState].pcszSocketStateName);
     345        }
     346    }
     347
     348    if (!cbReturn)
     349        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "[unknown state %RX32]", u32SocketState);
     350
     351    return cbReturn;
    338352}
    339353
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