VirtualBox

Ignore:
Timestamp:
Feb 4, 2009 10:14:33 AM (16 years ago)
Author:
vboxsync
Message:

NAT: soread aware of reading from closing socket

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
3 edited

Legend:

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

    r16496 r16501  
    870870                }
    871871
    872                 SOREAD(ret, pData, so, /*fCloseIfNothingRead=*/false);
     872                ret = soread(pData, so);
    873873                /* Output it if we read something */
    874874                if (ret > 0)
     
    887887                for (;;)
    888888                {
    889                     SOREAD(ret, pData, so, /*fCloseIfNothingRead=*/true);
     889                    ret = soread(pData, so);
    890890                    if (ret > 0)
    891891                        TCP_OUTPUT(pData, sototcpcb(so));
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r16498 r16501  
    100100#ifdef VBOX_WITH_SLIRP_MT
    101101void
    102 soread_queue(PNATState pData, struct socket *so, int fCloseIfNothingRead, int *ret)
    103 {
    104     *ret = soread(pData, so, fCloseIfNothingRead);
     102soread_queue(PNATState pData, struct socket *so, int *ret)
     103{
     104    *ret = soread(pData, so);
    105105}
    106106#endif
     
    112112 */
    113113int
    114 soread(PNATState pData, struct socket *so, int fCloseIfNothingRead)
     114soread(PNATState pData, struct socket *so)
    115115{
    116116    int n, nn, lss, total;
     
    202202         * would be dangerous.
    203203         */
    204         if (nn == 0 && !fCloseIfNothingRead)
     204        int status = 0;
     205        unsigned long pended = 0;
     206        int ignored;
     207        status = WSAIoctl(so->s, FIONREAD, NULL, 0, &pended, sizeof(unsigned long), &ignored, NULL, NULL);
     208        if(status < 0)
     209        {
     210            Log2(("error in WSAIoctl: %d\n", WSAGetLastError()));
     211        }
     212        if (nn == 0 && (pended != 0))
    205213        {
    206214            SOCKET_UNLOCK(so);
     
    278286     * urgent data.
    279287     */
    280     soread(pData, so, /*fCloseIfNothingRead=*/false);
     288    soread(pData, so);
    281289    tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
    282290    tp->t_force = 1;
  • trunk/src/VBox/Devices/Network/slirp/socket.h

    r16449 r16501  
    139139void sofree _P((PNATState, struct socket *));
    140140#ifdef VBOX_WITH_SLIRP_MT
    141 void soread_queue (PNATState, struct socket *, int, int *);
     141void soread_queue (PNATState, struct socket *, int *);
    142142#endif
    143 int soread _P((PNATState, struct socket *, int));
     143int soread _P((PNATState, struct socket *));
    144144void sorecvoob _P((PNATState, struct socket *));
    145145int sosendoob _P((struct socket *));
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