019dd84af1
In d5f0c87bb985ae344014dc2041fbaad5c522f638 this call to tcp_poll() was added to put a timeout on closing TCP sockets. But after calling tcp_close() the PCB may be freed and therefore invalid, so tcp_poll() can not be used at that point. As a fix this commit calls tcp_poll() before closing the TCP PCB. If the PCB is subsequently closed and freed by tcp_close() or tcp_abort() then the PCB will not be on any active list and the callback will not be executed, which is the desired behaviour (the _lwip_tcp_close_poll() callback only needs to be called if the PCB remains active for longer than the timeout).