SmingRTOS icon indicating copy to clipboard operation
SmingRTOS copied to clipboard

Use tcp_close to destroy the TCP listening socket.

Open alltheblinkythings opened this issue 9 years ago • 1 comments

It's an error to call tcp_poll() on a pcb that has been converted to a listening socket via tcp_listen(), with such calls causing memory corruption. Call tcp_close to destroy the socket instead in ~TcpServer, and NULL out tcp to suppress the call to tcp_poll in the base class (via ~TcpConnection()->TcpConnection::close()->tcp_poll()).

alltheblinkythings avatar Nov 22 '16 03:11 alltheblinkythings

@alltheblinkythings : I am looking into your remarks. Tcp_poll is not called by Sming framework, it comes from the LWIP processes. I think you are right on tcp_close() calling in ~TcpServer Will comment further shortly.

hreintke avatar Nov 25 '16 15:11 hreintke