[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] tcp_recv callback called with pcb->state == FIN_WAIT_1/
Re: [lwip-users] tcp_recv callback called with pcb->state == FIN_WAIT_1/2 -is this intentional?
Mon, 17 Aug 2009 14:31:07 +0100
On Mon, 2009-08-17 at 15:18 +0200, Domen Puncer wrote:
> I have a rawapi setup where lwip sends a request, and then receives a
> reply with size ~100kB, it forwards this reply via other means to
> device3 while it's still transferring via lwip, and if the transfer
> to device3 fails, it tcp_close()s the tcp connection too.
> Now, I'd expect tcp_recv callback to not be called again, but in fact
> it is, first time with FIN_WAIT_1, then with FIN_WAIT_2.
If you carry on receiving data after calling tcp_close then you'll
continue to get your callback called if it's still set. You should be
able to avoid this by setting the callback to NULL once you're no longer
interested in the received data. TCP connections have to be closed in
both directions before them become inactive, so by closing your end you
don't prevent the other end continuing to send to you. There are some
API improvements to this planned for 1.4.0: see