LWIP_EVENT_ERR may not generate XTCP_ABORTED
Posted: Mon Mar 12, 2018 6:38 pm
Hello,
I have my board acting as a TCP server. I am using the XTCP v7.0.0 beta -- which has several improvements in it -- from here: https://github.com/jh14778/lib_xtcp
However, I am seeing an issue where "LWIP_EVENT_ERR: Connection reset." can occur without issuing XTCP_ABORTED event. This occurs in the following situation (ERR_RST occurs before XTCP_SENT_DATA):
- I attempt to send data to peer using i_xtcp.send() and it returns OK
- Peer closes link before I receive XTCP_SENT_DATA Event
- LWIP_EVENT_ERR: Connection reset. events in lwip_tcp_event()
- I don't receive XTCP_SENT_DATA or XTCP_ABORTED
If instead of the above sequence, the ERR_RST occurs after XTCP_SENT_DATA, then I get the following
- I attempt to send data to peer using i_xtcp.send() and it returns OK
- I receive XTCP_SENT_DATA event
- Peer closes link
- LWIP_EVENT_ERR: Connection reset. events in lwip_tcp_event()
- I try to send more data, i_xtcp.send() errors with error -11
- I receive XTCP_ABORTED
Is there a fix for this that can be implemented in the xtcp_lwip.xc code? Perhaps I need to implement a fix when TCP_EVENT_ERR() is called in the underlying LWIP code upon ERR_RST?? There doesn't seem to be any way otherwise to generate an event because lwip executes memp_free(MEMP_TCP_PCB, pcb) so there's no conn we can event?? I apologize for any bad assumptions or general stupidity, my understanding of LWIP and the XTCP code is very minimal.
Obviously to test this issue it helps to have the XMOS chip try to hammer data at the peer. For me I am testing using putty in a raw connection on Win7 x64.
I have my board acting as a TCP server. I am using the XTCP v7.0.0 beta -- which has several improvements in it -- from here: https://github.com/jh14778/lib_xtcp
However, I am seeing an issue where "LWIP_EVENT_ERR: Connection reset." can occur without issuing XTCP_ABORTED event. This occurs in the following situation (ERR_RST occurs before XTCP_SENT_DATA):
- I attempt to send data to peer using i_xtcp.send() and it returns OK
- Peer closes link before I receive XTCP_SENT_DATA Event
- LWIP_EVENT_ERR: Connection reset. events in lwip_tcp_event()
- I don't receive XTCP_SENT_DATA or XTCP_ABORTED
If instead of the above sequence, the ERR_RST occurs after XTCP_SENT_DATA, then I get the following
- I attempt to send data to peer using i_xtcp.send() and it returns OK
- I receive XTCP_SENT_DATA event
- Peer closes link
- LWIP_EVENT_ERR: Connection reset. events in lwip_tcp_event()
- I try to send more data, i_xtcp.send() errors with error -11
- I receive XTCP_ABORTED
Is there a fix for this that can be implemented in the xtcp_lwip.xc code? Perhaps I need to implement a fix when TCP_EVENT_ERR() is called in the underlying LWIP code upon ERR_RST?? There doesn't seem to be any way otherwise to generate an event because lwip executes memp_free(MEMP_TCP_PCB, pcb) so there's no conn we can event?? I apologize for any bad assumptions or general stupidity, my understanding of LWIP and the XTCP code is very minimal.
Obviously to test this issue it helps to have the XMOS chip try to hammer data at the peer. For me I am testing using putty in a raw connection on Win7 x64.