Rev 5976 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5976 | Rev 6011 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | $Revision: 5976 $ |
17 | $Revision: 6011 $ |
18 | 18 | ||
19 | timer_flag_retransmission = 1 shl 0 |
19 | timer_flag_retransmission = 1 shl 0 |
20 | timer_flag_keepalive = 1 shl 1 |
20 | timer_flag_keepalive = 1 shl 1 |
21 | timer_flag_2msl = 1 shl 2 |
21 | timer_flag_2msl = 1 shl 2 |
Line 22... | Line 22... | ||
22 | timer_flag_persist = 1 shl 3 |
22 | timer_flag_persist = 1 shl 3 |
Line 23... | Line 23... | ||
23 | timer_flag_wait = 1 shl 4 |
23 | timer_flag_wait = 1 shl 4 |
24 | 24 | ||
Line 25... | Line 25... | ||
25 | 25 | ||
Line 43... | Line 43... | ||
43 | 43 | ||
Line 44... | Line 44... | ||
44 | and [ebx + TCP_SOCKET.t_flags], not (TF_DELACK) |
44 | and [ebx + TCP_SOCKET.t_flags], not (TF_DELACK) |
45 | 45 | ||
46 | push ebx |
46 | push ebx |
47 | mov cl, TH_ACK |
- | |
48 | call TCP_respond |
- | |
49 | ; and [ebx + TCP_SOCKET.t_flags], TF_ACKNOW ;; |
- | |
50 | ; mov eax, ebx ;; |
47 | mov cl, TH_ACK |
Line 51... | Line 48... | ||
51 | ; call TCP_output ;; |
48 | call tcp_respond |
Line 52... | Line 49... | ||
52 | pop ebx |
49 | pop ebx |
Line 59... | Line 56... | ||
59 | 56 | ||
Line 60... | Line 57... | ||
60 | } |
57 | } |
61 | 58 | ||
Line 62... | Line 59... | ||
62 | 59 | ||
63 | align 4 |
60 | align 4 |
64 | proc TCP_timer_640ms ; TODO: implement timed wait timer! |
61 | proc tcp_timer_640ms |
65 | 62 | ||
Line 75... | Line 72... | ||
75 | 72 | ||
Line 76... | Line 73... | ||
76 | ; Update TCP sequence number |
73 | ; Update TCP sequence number |
Line 77... | Line 74... | ||
77 | 74 | ||
78 | add [TCP_sequence_num], 64000 |
75 | add [TCP_sequence_num], 64000 |
Line 79... | Line 76... | ||
79 | 76 | ||
80 | ; scan through all the active TCP sockets, decrementing ALL timers |
77 | ; Scan through all the active TCP sockets, decrementing all active timers |
81 | ; When a timer reaches zero, we'll check wheter it was active or not |
78 | ; When a timer reaches zero, run its handler. |
82 | 79 | ||
Line 93... | Line 90... | ||
93 | cmp [eax + SOCKET.Protocol], IP_PROTO_TCP |
90 | cmp [eax + SOCKET.Protocol], IP_PROTO_TCP |
94 | jne .loop |
91 | jne .loop |
Line 95... | Line 92... | ||
95 | 92 | ||
Line 96... | Line -... | ||
96 | inc [eax + TCP_SOCKET.t_idle] |
- | |
97 | - | ||
98 | dec [eax + TCP_SOCKET.timer_retransmission] |
93 | inc [eax + TCP_SOCKET.t_idle] |
99 | jnz .check_more2 |
94 | |
- | 95 | test [eax + TCP_SOCKET.timer_flags], timer_flag_retransmission |
|
- | 96 | jz .check_more2 |
|
Line 100... | Line 97... | ||
100 | test [eax + TCP_SOCKET.timer_flags], timer_flag_retransmission |
97 | dec [eax + TCP_SOCKET.timer_retransmission] |
Line 101... | Line 98... | ||
101 | jz .check_more2 |
98 | jnz .check_more2 |
102 | 99 | ||
103 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Retransmission timer expired\n", eax |
100 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Retransmission timer expired\n", eax |
Line 104... | Line 101... | ||
104 | 101 | ||
105 | push eax |
- | |
106 | call TCP_output |
- | |
107 | pop eax |
102 | push eax |
108 | 103 | call tcp_output |
|
- | 104 | pop eax |
|
- | 105 | ||
Line 109... | Line 106... | ||
109 | .check_more2: |
106 | .check_more2: |
Line 110... | Line 107... | ||
110 | dec [eax + TCP_SOCKET.timer_keepalive] |
107 | test [eax + TCP_SOCKET.timer_flags], timer_flag_keepalive |
111 | jnz .check_more3 |
108 | jz .check_more3 |
Line 112... | Line 109... | ||
112 | test [eax + TCP_SOCKET.timer_flags], timer_flag_keepalive |
109 | dec [eax + TCP_SOCKET.timer_keepalive] |
113 | jz .check_more3 |
110 | jnz .check_more3 |
114 | 111 | ||
115 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Keepalive expired\n", eax |
112 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Keepalive expired\n", eax |
Line 116... | Line 113... | ||
116 | 113 | ||
117 | cmp [eax + TCP_SOCKET.state], TCPS_ESTABLISHED |
114 | cmp [eax + TCP_SOCKET.state], TCPS_ESTABLISHED |
118 | ja .dont_kill |
115 | ja .dont_kill |
Line 119... | Line 116... | ||
119 | 116 | ||
120 | push eax |
117 | push eax |
121 | call TCP_disconnect |
118 | call tcp_disconnect |
122 | pop eax |
119 | pop eax |
123 | jmp .loop |
120 | jmp .loop |
124 | 121 | ||
125 | .dont_kill: |
122 | .dont_kill: |
Line 126... | Line 123... | ||
126 | test [eax + SOCKET.options], SO_KEEPALIVE |
123 | test [eax + SOCKET.options], SO_KEEPALIVE |
127 | jz .reset_keepalive |
124 | jz .reset_keepalive |
Line 128... | Line 125... | ||
128 | 125 | ||
129 | push eax |
- | |
130 | mov ebx, eax |
- | |
131 | xor cl, cl |
126 | push eax |
132 | call TCP_respond ; send keepalive |
127 | mov ebx, eax |
- | 128 | xor cl, cl |
|
- | 129 | call tcp_respond ; send keepalive |
|
Line 133... | Line 130... | ||
133 | pop eax |
130 | pop eax |
Line 134... | Line 131... | ||
134 | mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_interval |
131 | mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_interval |
135 | jmp .check_more3 |
- | |
136 | - | ||
137 | .reset_keepalive: |
132 | jmp .check_more3 |
138 | mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_idle |
133 | |
- | 134 | .reset_keepalive: |
|
- | 135 | mov [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_idle |
|
Line 139... | Line 136... | ||
139 | 136 | ||
Line 140... | Line 137... | ||
140 | .check_more3: |
137 | .check_more3: |
141 | dec [eax + TCP_SOCKET.timer_timed_wait] |
138 | test [eax + TCP_SOCKET.timer_flags], timer_flag_2msl |
142 | jnz .check_more5 |
139 | jz .check_more5 |
143 | test [eax + TCP_SOCKET.timer_flags], timer_flag_2msl |
140 | dec [eax + TCP_SOCKET.timer_timed_wait] |
144 | jz .check_more5 |
141 | jnz .check_more5 |
145 | 142 | ||
Line 146... | Line 143... | ||
146 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: 2MSL timer expired\n", eax |
143 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: 2MSL timer expired\n", eax |
147 | - | ||
148 | .check_more5: |
- | |
149 | dec [eax + TCP_SOCKET.timer_persist] |
144 | |
150 | jnz .check_more6 |
145 | .check_more5: |
- | 146 | test [eax + TCP_SOCKET.timer_flags], timer_flag_persist |
|
- | 147 | jz .check_more6 |
|
Line 151... | Line 148... | ||
151 | test [eax + TCP_SOCKET.timer_flags], timer_flag_persist |
148 | dec [eax + TCP_SOCKET.timer_persist] |
Line 152... | Line 149... | ||
152 | jz .check_more6 |
149 | jnz .check_more6 |
153 | 150 | ||
154 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: persist timer expired\n", eax |
151 | DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: persist timer expired\n", eax |
Line 155... | Line 152... | ||
155 | 152 | ||
Line 156... | Line 153... | ||
156 | call TCP_set_persist |
153 | call tcp_set_persist |
Line 185... | Line 182... | ||
185 | ; ; |
182 | ; ; |
186 | ; OUT: / ; |
183 | ; OUT: / ; |
187 | ; ; |
184 | ; ; |
188 | ;-----------------------------------------------------------------; |
185 | ;-----------------------------------------------------------------; |
189 | align 4 |
186 | align 4 |
190 | TCP_cancel_timers: |
187 | tcp_cancel_timers: |
Line 191... | Line 188... | ||
191 | 188 | ||
Line 192... | Line 189... | ||
192 | mov [eax + TCP_SOCKET.timer_flags], 0 |
189 | mov [eax + TCP_SOCKET.timer_flags], 0 |
193 | 190 |