On Thu, Mar 24, 2011 at 11:55 AM, Brent Kucera
<address@hidden> wrote:
Hello,
First, I realize rc2 is out but I looked at the diff and changelog and this didn't seem to be addressed.
I'm using LWIP in standalone mode (no OS) and I'm testing the tcpecho_raw server with netcat. I connect to it as "netcat [ip] 7". I can then send some bytes, get some bytes back, all is good.
If I call echo_close while netcat is connected, tcp_close returns ERR_OK. If I then try to restart the server, tcp_bind fails with ERR_USE. The reason is that a pcb bound to port 7 is still in the tcp_active_pcbs list.
If I ctrl+c out of netcat before attempting to restart the server, the problem goes away because netcat sends a FIN packet and the stack removes the pcb from the tcp_active_pcbs list.
In tcp_close_shutdown, under case LISTEN, there's a line which removes the pcb from the tcp_listen_pcbs list. Since I'd like to be able to restart the server regardless of what the client does, I replaced this line with a loop which removes every PCB from every list which is bound to the same port as the pcb which tcp_close() was called with. This lets me restart the server since nothing is bound to port 7 anymore.
Will this have any unintended side effects, or is it dangerous or wrong to do?
Thanks,
Brent Kucera