1
10
13
14
20
21
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
182
183
184
185
187
188
189
195
201
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "tx_thread.h"
#include "tx_timer.h"
#include "nx_ip.h"
#include "nx_tcp.h"
5 includes
...
...
VOID _nx_tcp_transmit_cleanup(TX_THREAD *thread_ptr NX_CLEANUP_PARAMETER)
{
TX_INTERRUPT_SAVE_AREA
NX_TCP_SOCKET *socket_ptr;
NX_IP *ip_ptr;
NX_CLEANUP_EXTENSION
TX_DISABLE
socket_ptr = (NX_TCP_SOCKET *)thread_ptr -> tx_thread_suspend_control_block;
if ((!socket_ptr) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID))
{
TX_RESTORE
return;
}if ((!socket_ptr) || (socket_ptr -> nx_tcp_socket_id != NX_TCP_ID)) { ... }
if (!(thread_ptr -> tx_thread_suspend_cleanup))
{
TX_RESTORE
return;
}if (!(thread_ptr -> tx_thread_suspend_cleanup)) { ... }
#ifndef TX_TIMER_PROCESS_IN_ISR
if ((TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))
#else
if (TX_THREAD_GET_SYSTEM_STATE())
#endif
{
thread_ptr -> tx_thread_suspend_cleanup = _nx_tcp_cleanup_deferred;
ip_ptr = socket_ptr -> nx_tcp_socket_ip_ptr;
TX_RESTORE
tx_event_flags_set(&(ip_ptr -> nx_ip_events), NX_IP_TCP_CLEANUP_DEFERRED, TX_OR);
return;
...}
else
{
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
if (thread_ptr == thread_ptr -> tx_thread_suspended_next)
{
socket_ptr -> nx_tcp_socket_transmit_suspension_list = NX_NULL;
}if (thread_ptr == thread_ptr -> tx_thread_suspended_next) { ... }
else
{
socket_ptr -> nx_tcp_socket_transmit_suspension_list = thread_ptr -> tx_thread_suspended_next;
(thread_ptr -> tx_thread_suspended_next) -> tx_thread_suspended_previous =
thread_ptr -> tx_thread_suspended_previous;
(thread_ptr -> tx_thread_suspended_previous) -> tx_thread_suspended_next =
thread_ptr -> tx_thread_suspended_next;
}else { ... }
socket_ptr -> nx_tcp_socket_transmit_suspended_count--;
/* ... */
if (thread_ptr -> tx_thread_state == TX_TCP_IP)
{
/* ... */
if (socket_ptr -> nx_tcp_socket_state != NX_TCP_ESTABLISHED)
{
thread_ptr -> tx_thread_suspend_status = NX_NOT_CONNECTED;
}if (socket_ptr -> nx_tcp_socket_state != NX_TCP_ESTABLISHED) { ... }
else if (socket_ptr -> nx_tcp_socket_transmit_sent_count < socket_ptr -> nx_tcp_socket_transmit_queue_maximum)
{
thread_ptr -> tx_thread_suspend_status = NX_WINDOW_OVERFLOW;
}else if (socket_ptr -> nx_tcp_socket_transmit_sent_count < socket_ptr -> nx_tcp_socket_transmit_queue_maximum) { ... }
else
{
thread_ptr -> tx_thread_suspend_status = NX_TX_QUEUE_DEPTH;
}else { ... }
_tx_thread_preempt_disable++;
TX_RESTORE
_tx_thread_system_resume(thread_ptr);
return;
}if (thread_ptr -> tx_thread_state == TX_TCP_IP) { ... }
}else { ... }
TX_RESTORE
}{ ... }