VirtualBox

Changeset 15220 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Dec 10, 2008 2:45:14 AM (16 years ago)
Author:
vboxsync
Message:

slirp: readability

File:
1 edited

Legend:

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

    r15210 r15220  
    2626        UPD_NFDS((so)->s);                           \
    2727    } while(0)
     28
     29# define DO_POLL_EVENTS(rc, error, so, events, label) do {} while (0)
    2830
    2931# ifdef VBOX_WITH_SLIRP_ICMP
     
    6062    DO_ENGAGE_EVENT1((so), (fdset1), label)
    6163
     64# define DO_POLL_EVENTS(rc, error, so, events, label)                       \
     65    (rc) = WSAEnumNetworkEvents((so)->s, VBOX_SOCKET_EVENT, (events));      \
     66    if ((rc) == SOCKET_ERROR)                                               \
     67    {                                                                       \
     68        (error) = WSAGetLastError();                                        \
     69        LogRel(("WSAEnumNetworkEvents " #label " error %d\n", (error)));    \
     70        continue;                                                           \
     71    }
     72
    6273#endif /* defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) */
    6374
     
    7081#define UDP_ENGAGE_EVENT(so, fdset) \
    7182    DO_ENGAGE_EVENT1((so), (fdset), UDP)
     83
     84#define POLL_TCP_EVENTS(rc, error, so, events) \
     85    DO_POLL_EVENTS((rc), (error), (so), (events), TCP)
     86
     87#define POLL_UDP_EVENTS(rc, error, so, events) \
     88    DO_POLL_EVENTS((rc), (error), (so), (events), UDP)
    7289
    7390static const uint8_t special_ethaddr[6] =
     
    687704                continue;
    688705
    689 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    690             rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents);
    691             if (rc == SOCKET_ERROR)
    692             {
    693                 error = WSAGetLastError();
    694                 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error));
    695                 continue;
    696             }
    697 #endif
     706            POLL_TCP_EVENTS(rc, error, so, NetworkEvents);
    698707
    699708            /*
     
    873882            so_next = so->so_next;
    874883
    875 #if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    876             rc = WSAEnumNetworkEvents(so->s, VBOX_SOCKET_EVENT, &NetworkEvents);
    877             if (rc == SOCKET_ERROR)
    878             {
    879                 error = WSAGetLastError();
    880                 LogRel(("WSAEnumNetworkEvents TCP error %d\n", error));
    881                 continue;
    882             }
    883 #endif
     884            POLL_UDP_EVENTS(rc, error, so, NetworkEvents);
     885
    884886#if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) || !defined(RT_OS_WINDOWS)
    885887            if (so->s != -1 && FD_ISSET(so->s, readfds))
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