Changeset 51332 in vbox for trunk/src/VBox/NetworkServices
- Timestamp:
- May 22, 2014 1:52:41 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93816
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/pxtcp.c
r51300 r51332 255 255 static err_t pxtcp_pcb_forward_outbound(struct pxtcp *, struct pbuf *); 256 256 static void pxtcp_pcb_forward_outbound_close(struct pxtcp *); 257 258 static ssize_t pxtcp_sock_send(struct pxtcp *, IOVEC *, size_t); 257 259 258 260 static void pxtcp_pcb_forward_inbound(struct pxtcp *); … … 1428 1430 int sockerr; 1429 1431 1430 #if defined(MSG_NOSIGNAL)1431 const int send_flags = MSG_NOSIGNAL;1432 #else1433 const int send_flags = 0;1434 #endif1435 1436 1437 1432 LWIP_ASSERT1(pxtcp->unsent == NULL || pxtcp->unsent == p); 1438 1433 … … 1445 1440 qs = p; 1446 1441 while (qs != NULL) { 1447 #ifndef RT_OS_WINDOWS1448 struct msghdr mh;1449 #else1450 int rc;1451 #endif1452 1442 IOVEC iov[8]; 1453 1443 const size_t iovsize = sizeof(iov)/sizeof(iov[0]); … … 1464 1454 } 1465 1455 1466 #ifndef RT_OS_WINDOWS 1467 memset(&mh, 0, sizeof(mh)); 1468 mh.msg_iov = iov; 1469 mh.msg_iovlen = i; 1470 1471 nsent = sendmsg(pxtcp->sock, &mh, send_flags); 1472 #else 1473 /** 1474 * WSASend(,,,DWORD *,,,) - takes SSIZE_T (64bit value) ... so all nsent's 1475 * bits should be zeroed before passing to WSASent. 1456 /* 1457 * TODO: This is where application-level proxy can hook into 1458 * to process outbound traffic. 1476 1459 */ 1477 nsent = 0; 1478 rc = WSASend(pxtcp->sock, iov, (DWORD)i, (DWORD *)&nsent, 0, NULL, NULL); 1479 if (rc == SOCKET_ERROR) { 1480 /* WSASent reports SOCKET_ERROR and updates error accessible with 1481 * WSAGetLastError(). We assign nsent to -1, enforcing code below 1482 * to access error in BSD style. 1483 */ 1484 warn("pxtcp_pcb_forward_outbound:WSASend error:%d nsent:%d\n", 1485 WSAGetLastError(), 1486 nsent); 1487 nsent = -1; 1488 } 1489 #endif 1460 nsent = pxtcp_sock_send(pxtcp, iov, i); 1490 1461 1491 1462 if (nsent == (ssize_t)fwd1) { … … 1581 1552 return ERR_OK; 1582 1553 } 1554 1555 1556 #if !defined(RT_OS_WINDOWS) 1557 static ssize_t 1558 pxtcp_sock_send(struct pxtcp *pxtcp, IOVEC *iov, size_t iovlen) 1559 { 1560 struct msghdr mh; 1561 ssize_t nsent; 1562 1563 #ifdef MSG_NOSIGNAL 1564 const int send_flags = MSG_NOSIGNAL; 1565 #else 1566 const int send_flags = 0; 1567 #endif 1568 1569 memset(&mh, 0, sizeof(mh)); 1570 1571 mh.msg_iov = iov; 1572 mh.msg_iovlen = iovlen; 1573 1574 nsent = sendmsg(pxtcp->sock, &mh, send_flags); 1575 1576 return nsent; 1577 } 1578 #else /* RT_OS_WINDOWS */ 1579 static ssize_t 1580 pxtcp_sock_send(struct pxtcp *pxtcp, IOVEC *iov, size_t iovlen) 1581 { 1582 DWORD nsent; 1583 int status; 1584 1585 status = WSASend(pxtcp->sock, iov, (DWORD)iovlen, &nsent, 1586 0, NULL, NULL); 1587 if (status == SOCKET_ERROR) { 1588 nsent = -1; 1589 } 1590 1591 return nsent; 1592 } 1593 #endif /* RT_OS_WINDOWS */ 1583 1594 1584 1595
Note:
See TracChangeset
for help on using the changeset viewer.