MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / close_chargen

Function close_chargen

examples/network/chargen.c:181–203  ·  view source on GitHub ↗

* void close_chargen(struct charcb *p_charcb) * * Close the socket and remove this charcb from the list. **************************************************************/

Source from the content-addressed store, hash-verified

179 * Close the socket and remove this charcb from the list.
180 **************************************************************/
181static void close_chargen(struct charcb *p_charcb)
182{
183 struct charcb *p_search_charcb;
184
185 /* Either an error or tcp connection closed on other
186 * end. Close here */
187 closesocket(p_charcb->socket);
188
189 /* Free charcb */
190 if (charcb_list == p_charcb)
191 charcb_list = p_charcb->next;
192 else
193 for (p_search_charcb = charcb_list; p_search_charcb; p_search_charcb = p_search_charcb->next)
194 {
195 if (p_search_charcb->next == p_charcb)
196 {
197 p_search_charcb->next = p_charcb->next;
198 break;
199 }
200 }
201
202 rt_free(p_charcb);
203}
204
205/**************************************************************
206 * void do_read(struct charcb *p_charcb)

Callers 2

chargen_threadFunction · 0.85
do_readFunction · 0.85

Calls 2

closesocketFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected