VirtualBox

Changeset 47966 in vbox for trunk


Ignore:
Timestamp:
Aug 21, 2013 1:25:41 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88283
Message:

lwip-nat: zero counter of sent bytes before sending to WSASend(,&nsent,), and assign it to -1 explicitly on error (SOCKET_ERROR).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/lwip-new/vbox/pxtcp.c

    r47886 r47966  
    14691469        nsent = sendmsg(pxtcp->sock, &mh, send_flags);
    14701470#else
    1471         nsent = -1; /* unix send*'s "assignment" semantic, that different from WSA */
     1471        /**
     1472         * WSASend(,,,DWORD *,,,) - takes SSIZE_T (64bit value) ... so all nsent's
     1473         * bits should be zeroed before passing to WSASent.
     1474         */
     1475        nsent = 0;
    14721476        rc = WSASend(pxtcp->sock, iov, (DWORD)i, (DWORD *)&nsent, 0, NULL, NULL);
    14731477        if (rc == SOCKET_ERROR) {
    1474             /* WSASent reports both status code and nsent
    1475              * need some eurisitic how to work with it.
     1478            /* WSASent reports SOCKET_ERROR and updates error accessible with
     1479             * WSAGetLastError(). We assign nsent to -1, enforcing code below
     1480             * to access error in BSD style.
    14761481             */
    14771482            warn("pxtcp_pcb_forward_outbound:WSASend error:%d nsent:%d\n",
    14781483                 WSAGetLastError(),
    14791484                 nsent);
    1480         }
     1485            nsent = -1;
     1486       }
    14811487#endif
     1488 
    14821489        if (nsent == (ssize_t)fwd1) {
    14831490            /* successfully sent this chain fragment completely */
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