VirtualBox

Ignore:
Timestamp:
Apr 9, 2012 8:13:57 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77350
Message:

NAT: make sure that socket is still on queue, before doing any further diagnostic and operations.

File:
1 edited

Legend:

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

    r40583 r40835  
    13071307            || (so->so_close == 1))
    13081308        {
     1309            struct socket *pPrevSo = NULL;
     1310            /**
     1311             * we need easy way to detection mechanism if socket has been freed or not
     1312             * before continuing any further diagnostic.
     1313             */
     1314            pPrevSo = so->so_prev;
     1315            AssertPtr(pPrevSo);
    13091316            /*
    13101317             * drain the socket
    13111318             */
    1312             for (;;)
     1319            for (; pPrevSo->so_next == so ;)
    13131320            {
    13141321                ret = soread(pData, so);
    13151322                if (ret > 0)
    13161323                    TCP_OUTPUT(pData, sototcpcb(so));
    1317                 else
     1324                else if (pPrevSo->so_next == so)
    13181325                {
    13191326                    Log2(("%R[natsock] errno %d (%s)\n", so, errno, strerror(errno)));
     
    13211328                }
    13221329            }
    1323             /* mark the socket for termination _after_ it was drained */
    1324             so->so_close = 1;
    1325             /* No idea about Windows but on Posix, POLLHUP means that we can't send more.
    1326              * Actually in the specific error scenario, POLLERR is set as well. */
     1330            if (pPrevSo->so_next == so)
     1331            {
     1332                /* mark the socket for termination _after_ it was drained */
     1333                so->so_close = 1;
     1334                /* No idea about Windows but on Posix, POLLHUP means that we can't send more.
     1335                 * Actually in the specific error scenario, POLLERR is set as well. */
    13271336#ifndef RT_OS_WINDOWS
    1328             if (CHECK_FD_SET(so, NetworkEvents, rderr))
    1329                 sofcantsendmore(so);
    1330 #endif
     1337                if (CHECK_FD_SET(so, NetworkEvents, rderr))
     1338                    sofcantsendmore(so);
     1339#endif
     1340            }
    13311341            CONTINUE(tcp);
    13321342        }
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