Changeset 16562 in vbox
- Timestamp:
- Feb 9, 2009 4:02:02 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 42516
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r16540 r16562 622 622 * See if we need a tcp_fasttimo 623 623 */ 624 if ( time_fasttimo == 0 624 if ( time_fasttimo == 0 625 625 && so->so_tcpcb != NULL 626 626 && so->so_tcpcb->t_flags & TF_DELACK) … … 801 801 802 802 #ifdef VBOX_WITH_SLIRP_MT 803 if ( so->so_state & SS_NOFDREF 804 && so->so_deleted == 1) 805 { 803 if ( so->so_state & SS_NOFDREF 804 && so->so_deleted == 1) 805 { 806 806 struct socket *son, *sop = NULL; 807 807 QSOCKET_LOCK(tcb); 808 if (so->so_next != NULL) 808 if (so->so_next != NULL) 809 809 { 810 810 if (so->so_next != &tcb) … … 813 813 } 814 814 if ( so->so_prev != &tcb 815 && so->so_prev != NULL) 815 && so->so_prev != NULL) 816 816 { 817 817 SOCKET_LOCK(so->so_prev); … … 820 820 QSOCKET_UNLOCK(tcb); 821 821 remque(pData, so); 822 NSOCK_DEC(); 822 823 SOCKET_UNLOCK(so); 823 824 SOCKET_LOCK_DESTROY(so); … … 1007 1008 /* { */ 1008 1009 #ifdef VBOX_WITH_SLIRP_MT 1009 if ( so->so_state & SS_NOFDREF 1010 && so->so_deleted == 1) 1011 { 1010 if ( so->so_state & SS_NOFDREF 1011 && so->so_deleted == 1) 1012 { 1012 1013 struct socket *son, *sop = NULL; 1013 1014 QSOCKET_LOCK(udb); 1014 if (so->so_next != NULL) 1015 if (so->so_next != NULL) 1015 1016 { 1016 1017 if (so->so_next != &udb) … … 1019 1020 } 1020 1021 if ( so->so_prev != &udb 1021 && so->so_prev != NULL) 1022 && so->so_prev != NULL) 1022 1023 { 1023 1024 SOCKET_LOCK(so->so_prev); … … 1026 1027 QSOCKET_UNLOCK(udb); 1027 1028 remque(pData, so); 1029 NSOCK_DEC(); 1028 1030 SOCKET_UNLOCK(so); 1029 1031 SOCKET_LOCK_DESTROY(so); -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r16448 r16562 57 57 { 58 58 struct in_addr de_addr; 59 LIST_ENTRY(dns_entry) de_list; 59 LIST_ENTRY(dns_entry) de_list; 60 60 }; 61 61 LIST_HEAD(dns_list_head, dns_entry); … … 143 143 struct socket icmp_socket; 144 144 struct icmp_storage icmp_msg_head; 145 # ifndef RT_OS_WINDOWS 146 /* counter of sockets needed for allocation enough room to 147 * process sockets with poll/epoll 148 * 149 * NSOCK_INC/DEC should be injected before every 150 * operation on socket queue (tcb, udb) 151 */ 152 int nsock; 153 # define NSOCK_INC() do {pData->nsock++;} while (0) 154 # define NSOCK_DEC() do {pData->nsock--;} while (0) 155 # else 156 # define NSOCK_INC() do {} while (0) 157 # define NSOCK_DEC() do {} while (0) 158 # endif 145 159 # ifdef RT_OS_WINDOWS 146 160 void *pvIcmpBuffer; … … 345 359 loop_end_ ## label ## _mt_nounlock: \ 346 360 (so) = (sonext) 347 361 348 362 #define DO_TCP_OUTPUT(data, sotcb) \ 349 363 do { \ … … 527 541 } \ 528 542 } \ 529 }while (0) 530 543 }while (0) 544 531 545 #else 532 546 #define QSOCKET_LOCK(queue) do {} while (0) -
trunk/src/VBox/Devices/Network/slirp/socket.c
r16511 r16562 90 90 if(so->so_next && so->so_prev) 91 91 remque(pData, so); /* crashes if so is not in a queue */ 92 NSOCK_DEC(); 92 93 so->so_state = SS_NOFDREF; /* for debugging purposes */ 93 94 … … 378 379 if (sb->sb_cc == 0) 379 380 { 380 SOCKET_UNLOCK(so); 381 SOCKET_UNLOCK(so); 381 382 return 0; 382 383 } … … 428 429 if (nn < 0 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) 429 430 { 430 SOCKET_UNLOCK(so); 431 SOCKET_UNLOCK(so); 431 432 return 0; 432 433 } … … 438 439 sofcantsendmore(so); 439 440 tcp_sockclosed(pData, sototcpcb(so)); 440 SOCKET_UNLOCK(so); 441 SOCKET_UNLOCK(so); 441 442 return -1; 442 443 } … … 466 467 sofcantsendmore(so); 467 468 468 SOCKET_UNLOCK(so); 469 SOCKET_UNLOCK(so); 469 470 return nn; 470 471 } … … 503 504 QSOCKET_UNLOCK(udb); 504 505 505 if (!(m = m_get(pData))) 506 if (!(m = m_get(pData))) 506 507 { 507 508 SOCKET_UNLOCK(so); … … 698 699 QSOCKET_LOCK(tcb); 699 700 insque(pData, so,&tcb); 701 NSOCK_INC(); 700 702 QSOCKET_UNLOCK(tcb); 701 703 -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r16531 r16562 356 356 } 357 357 /* soisfdisconnecting(tp->t_socket); */ 358 if ( tp 358 if ( tp 359 359 && tp->t_state >= TCPS_FIN_WAIT_2) 360 360 soisfdisconnected(tp->t_socket); … … 500 500 optlen = sizeof(int); 501 501 status = getsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, &optlen); 502 if (status < 0) 502 if (status < 0) 503 503 { 504 504 LogRel(("NAT: Error(%d) while getting RCV capacity\n", errno)); … … 508 508 LogRel(("NAT: old socket rcv size: %dKB\n", opt / 1024)); 509 509 opt *= 4; 510 status = setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(int)); 511 if (status < 0) 510 status = setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(int)); 511 if (status < 0) 512 512 { 513 513 LogRel(("NAT: Error(%d) while setting RCV capacity to (%d)\n", errno, opt)); … … 516 516 optlen = sizeof(int); 517 517 status = getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen); 518 if (status < 0) 518 if (status < 0) 519 519 { 520 520 LogRel(("NAT: Error(%d) while getting SND capacity\n", errno)); … … 524 524 LogRel(("NAT: old socket snd size: %dKB\n", opt / 1024)); 525 525 opt *= 4; 526 status = setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(int)); 527 if (status < 0) 526 status = setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(int)); 527 if (status < 0) 528 528 { 529 529 LogRel(("NAT: Error(%d) while setting SND capacity to (%d)\n", errno, opt)); … … 580 580 return -1; 581 581 582 SOCKET_LOCK_CREATE(so); 582 SOCKET_LOCK_CREATE(so); 583 583 QSOCKET_LOCK(tcb); 584 584 insque(pData, so, &tcb); 585 NSOCK_INC(); 585 586 QSOCKET_UNLOCK(tcb); 586 587 return 0; … … 808 809 if ( m->m_data[m->m_len-1] == '\0' 809 810 && lport != 0 810 && (so = solisten(pData, 0, so->so_laddr.s_addr, 811 && (so = solisten(pData, 0, so->so_laddr.s_addr, 811 812 htons(lport), SS_FACCEPTONCE)) != NULL) 812 813 m->m_len = sprintf(m->m_data, "%d", ntohs(so->so_fport))+1; … … 824 825 if (sscanf(bptr, "DCC CHAT %256s %u %u", buff, &laddr, &lport) == 3) 825 826 { 826 if ((so = solisten(pData, 0, htonl(laddr), 827 if ((so = solisten(pData, 0, htonl(laddr), 827 828 htons(lport), SS_FACCEPTONCE)) == NULL) 828 829 return 1; -
trunk/src/VBox/Devices/Network/slirp/udp.c
r16511 r16562 160 160 * handle TFTP 161 161 */ 162 if ( ntohs(uh->uh_dport) == TFTP_SERVER 162 if ( ntohs(uh->uh_dport) == TFTP_SERVER 163 163 && CTL_CHECK(ntohl(ip->ip_dst.s_addr), CTL_TFTP)) 164 164 { … … 391 391 QSOCKET_LOCK(udb); 392 392 insque(pData, so,&udb); 393 NSOCK_INC(); 393 394 QSOCKET_UNLOCK(udb); 394 395 } … … 706 707 QSOCKET_LOCK(udb); 707 708 insque(pData, so,&udb); 709 NSOCK_INC(); 708 710 QSOCKET_UNLOCK(udb); 709 711
Note:
See TracChangeset
for help on using the changeset viewer.