Steinberg Michael wrote:
Hello,

Here's a bit more context to my problem. When I call tcp_close in reaction to being handed a NULL 
pbuf ptr in the receive-callback, this is what happens inside file  "tcp.c": Eventually 
tcp_close_shutdown is called with the tcp_pcb in state CLOSE_WAIT. The "Not all data received 
by application ... " branch is taken and then on line 279 the pcb is removed from the active 
pcb list. At this point ALL lists (eg. tcp_bound_pcbs, tcp_listen_pcbs, tcp_active_pcbs, 
tcp_tw_pcbs) are empty. Then since I called tcp_close from within the recv handler, the branch on 
ln. 288 is taken, which merely sets a flag so the pcb is deleted later-on. But since the pcb is in 
no list of lwip anymore that I'm aware of, how would that deferred delete even work?

Maybe you can spot my misconception better with these details?

Sorry it took so long to read this. Seems you're right: the check for "recv_flags & TF_CLOSED" must be moved down in tcp_input() so that delayed close works from the TCP_EVENT_CLOSED() callback, too. I'll file a bug.


Simon

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to