Changeset 20171 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Jun 2, 2009 2:36:01 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r20170 r20171 852 852 */ 853 853 do_slowtimo = 0; 854 if (link_up) 855 { 854 if (!link_up) 855 goto done; 856 /* 857 * *_slowtimo needs calling if there are IP fragments 858 * in the fragment queue, or there are TCP connections active 859 */ 860 /* XXX: 861 * triggering of fragment expiration should be the same but use new macroses 862 */ 863 do_slowtimo = (tcb.so_next != &tcb); 864 if (!do_slowtimo) 865 { 866 for (i = 0; i < IPREASS_NHASH; i++) 867 { 868 if (!TAILQ_EMPTY(&ipq[i])) 869 { 870 do_slowtimo = 1; 871 break; 872 } 873 } 874 } 875 ICMP_ENGAGE_EVENT(&pData->icmp_socket, readfds); 876 877 STAM_COUNTER_RESET(&pData->StatTCP); 878 STAM_COUNTER_RESET(&pData->StatTCPHot); 879 880 QSOCKET_FOREACH(so, so_next, tcp) 881 /* { */ 882 #if !defined(RT_OS_WINDOWS) 883 so->so_poll_index = -1; 884 #endif 885 STAM_COUNTER_INC(&pData->StatTCP); 886 856 887 /* 857 * *_slowtimo needs calling if there are IP fragments 858 * in the fragment queue, or there are TCP connections active 888 * See if we need a tcp_fasttimo 859 889 */ 860 /* XXX: 861 * triggering of fragment expiration should be the same but use new macroses 890 if ( time_fasttimo == 0 891 && so->so_tcpcb != NULL 892 && so->so_tcpcb->t_flags & TF_DELACK) 893 time_fasttimo = curtime; /* Flag when we want a fasttimo */ 894 895 /* 896 * NOFDREF can include still connecting to local-host, 897 * newly socreated() sockets etc. Don't want to select these. 862 898 */ 863 do_slowtimo = (tcb.so_next != &tcb); 864 if (!do_slowtimo) 865 { 866 for (i = 0; i < IPREASS_NHASH; i++) 867 { 868 if (!TAILQ_EMPTY(&ipq[i])) 869 { 870 do_slowtimo = 1; 871 break; 872 } 873 } 874 } 875 ICMP_ENGAGE_EVENT(&pData->icmp_socket, readfds); 876 877 STAM_COUNTER_RESET(&pData->StatTCP); 878 STAM_COUNTER_RESET(&pData->StatTCPHot); 879 880 QSOCKET_FOREACH(so, so_next, tcp) 881 /* { */ 899 if (so->so_state & SS_NOFDREF || so->s == -1) 900 CONTINUE(tcp); 901 902 /* 903 * Set for reading sockets which are accepting 904 */ 905 if (so->so_state & SS_FACCEPTCONN) 906 { 907 STAM_COUNTER_INC(&pData->StatTCPHot); 908 TCP_ENGAGE_EVENT1(so, readfds); 909 CONTINUE(tcp); 910 } 911 912 /* 913 * Set for writing sockets which are connecting 914 */ 915 if (so->so_state & SS_ISFCONNECTING) 916 { 917 Log2(("connecting %R[natsock] engaged\n",so)); 918 STAM_COUNTER_INC(&pData->StatTCPHot); 919 TCP_ENGAGE_EVENT1(so, writefds); 920 } 921 922 /* 923 * Set for writing if we are connected, can send more, and 924 * we have something to send 925 */ 926 if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) 927 { 928 STAM_COUNTER_INC(&pData->StatTCPHot); 929 TCP_ENGAGE_EVENT1(so, writefds); 930 } 931 932 /* 933 * Set for reading (and urgent data) if we are connected, can 934 * receive more, and we have room for it XXX /2 ? 935 */ 936 if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) 937 { 938 STAM_COUNTER_INC(&pData->StatTCPHot); 939 TCP_ENGAGE_EVENT2(so, readfds, xfds); 940 } 941 LOOP_LABEL(tcp, so, so_next); 942 } 943 944 /* 945 * UDP sockets 946 */ 947 STAM_COUNTER_RESET(&pData->StatUDP); 948 STAM_COUNTER_RESET(&pData->StatUDPHot); 949 950 QSOCKET_FOREACH(so, so_next, udp) 951 /* { */ 952 953 STAM_COUNTER_INC(&pData->StatUDP); 882 954 #if !defined(RT_OS_WINDOWS) 883 so->so_poll_index = -1; 884 #endif 885 STAM_COUNTER_INC(&pData->StatTCP); 886 887 /* 888 * See if we need a tcp_fasttimo 889 */ 890 if ( time_fasttimo == 0 891 && so->so_tcpcb != NULL 892 && so->so_tcpcb->t_flags & TF_DELACK) 893 time_fasttimo = curtime; /* Flag when we want a fasttimo */ 894 895 /* 896 * NOFDREF can include still connecting to local-host, 897 * newly socreated() sockets etc. Don't want to select these. 898 */ 899 if (so->so_state & SS_NOFDREF || so->s == -1) 900 CONTINUE(tcp); 901 902 /* 903 * Set for reading sockets which are accepting 904 */ 905 if (so->so_state & SS_FACCEPTCONN) 906 { 907 STAM_COUNTER_INC(&pData->StatTCPHot); 908 TCP_ENGAGE_EVENT1(so, readfds); 909 CONTINUE(tcp); 910 } 911 912 /* 913 * Set for writing sockets which are connecting 914 */ 915 if (so->so_state & SS_ISFCONNECTING) 916 { 917 Log2(("connecting %R[natsock] engaged\n",so)); 918 STAM_COUNTER_INC(&pData->StatTCPHot); 919 TCP_ENGAGE_EVENT1(so, writefds); 920 } 921 922 /* 923 * Set for writing if we are connected, can send more, and 924 * we have something to send 925 */ 926 if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) 927 { 928 STAM_COUNTER_INC(&pData->StatTCPHot); 929 TCP_ENGAGE_EVENT1(so, writefds); 930 } 931 932 /* 933 * Set for reading (and urgent data) if we are connected, can 934 * receive more, and we have room for it XXX /2 ? 935 */ 936 if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) 937 { 938 STAM_COUNTER_INC(&pData->StatTCPHot); 939 TCP_ENGAGE_EVENT2(so, readfds, xfds); 940 } 941 LOOP_LABEL(tcp, so, so_next); 942 } 955 so->so_poll_index = -1; 956 #endif 943 957 944 958 /* 945 * UDP sockets959 * See if it's timed out 946 960 */ 947 STAM_COUNTER_RESET(&pData->StatUDP); 948 STAM_COUNTER_RESET(&pData->StatUDPHot); 949 950 QSOCKET_FOREACH(so, so_next, udp) 951 /* { */ 952 953 STAM_COUNTER_INC(&pData->StatUDP); 954 #if !defined(RT_OS_WINDOWS) 955 so->so_poll_index = -1; 956 #endif 957 958 /* 959 * See if it's timed out 960 */ 961 if (so->so_expire) 962 { 963 if (so->so_expire <= curtime) 964 { 961 if (so->so_expire) 962 { 963 if (so->so_expire <= curtime) 964 { 965 965 #ifdef VBOX_WITH_SLIRP_DNS_PROXY 966 966 Log2(("NAT: %R[natsock] expired\n", so)); … … 1000 1000 1001 1001 } 1002 done: 1002 1003 1003 1004 #if defined(RT_OS_WINDOWS)
Note:
See TracChangeset
for help on using the changeset viewer.