VirtualBox

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


Ignore:
Timestamp:
Aug 31, 2016 2:54:40 PM (8 years ago)
Author:
vboxsync
Message:

NAT: soread - check FIONREAD only when necessary.

File:
1 edited

Legend:

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

    r63672 r63675  
    327327    if (nn <= 0)
    328328    {
    329         /*
    330          * Special case for WSAEnumNetworkEvents: If we receive 0 bytes that
    331          * _could_ mean that the connection is closed. But we will receive an
    332          * FD_CLOSE event later if the connection was _really_ closed. With
    333          * www.youtube.com I see this very often. Closing the socket too early
    334          * would be dangerous.
    335          */
    336         int status;
    337         unsigned long pending = 0;
    338         status = ioctlsocket(so->s, FIONREAD, &pending);
    339         if (status < 0)
    340             Log(("NAT:%s: error in WSAIoctl: %d\n", RT_GCC_EXTENSION __PRETTY_FUNCTION__, errno));
    341         if (nn == 0 && (pending != 0))
    342         {
    343             SOCKET_UNLOCK(so);
    344             STAM_PROFILE_STOP(&pData->StatIOread, a);
    345             return 0;
    346         }
     329        if (nn == 0) /* XXX: should this be inside #if defined(RT_OS_WINDOWS)? */
     330        {
     331            /*
     332             * Special case for WSAEnumNetworkEvents: If we receive 0 bytes that
     333             * _could_ mean that the connection is closed. But we will receive an
     334             * FD_CLOSE event later if the connection was _really_ closed. With
     335             * www.youtube.com I see this very often. Closing the socket too early
     336             * would be dangerous.
     337             */
     338            int status;
     339            unsigned long pending = 0;
     340            status = ioctlsocket(so->s, FIONREAD, &pending);
     341            if (status < 0)
     342                Log(("NAT:%s: error in WSAIoctl: %d\n", RT_GCC_EXTENSION __PRETTY_FUNCTION__, errno));
     343            if (pending != 0)
     344            {
     345                SOCKET_UNLOCK(so);
     346                STAM_PROFILE_STOP(&pData->StatIOread, a);
     347                return 0;
     348            }
     349        }
     350
    347351        if (   nn < 0
    348352            && soIgnorableErrorCode(sockerr))
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