Conversation
When a TCP connection in eCONNECT_SYN state times out after exceeding the maximum retry count, the socket was incorrectly transitioning to eCLOSE_WAIT state instead of eCLOSED. According to the standard TCP state machine (RFC 793): - eCONNECT_SYN is the state where a client has sent a SYN and is waiting for a SYN-ACK - When connection establishment fails (timeout or RST), the socket should transition to eCLOSED state This fix: 1. Changes the state transition in prvTCPSendPacket() from eCLOSE_WAIT to eCLOSED when SYN retries are exhausted 2. Updates vTCPStateChange() to handle the eCONNECT_SYN -> eCLOSED transition, ensuring connection state change callbacks are properly triggered. This also aligns the timeout behavior with the existing RST handling code, which correctly uses eCLOSED state (see FreeRTOS_TCP_IP.c:859). Files changed: - source/FreeRTOS_TCP_Transmission.c: Fix state transition - source/FreeRTOS_TCP_IP.c: Update vTCPStateChange to handle eCLOSED transition from connecting states
|
@Fr3ya , I have fixed the unit tests. I will send you an update later today. |
|
@Fr3ya , I made some changes to repair the unit testing and 100% coverage : Can you apply my patch and do a new commit? Here are the plain files in a zip: ut_changes_htibosch.zip |
|
Hi @htibosch, I have applied the patch that you posted, thanks! |
|
Hello, can anyone approve and merge this PR please? |
|
I think this PR also fixes another issue I was seeing: If you attempt to |
When a TCP connection in eCONNECT_SYN state times out after exceeding the maximum retry count, the socket was incorrectly transitioning to eCLOSE_WAIT state instead of eCLOSED.
According to the standard TCP state machine (RFC 793):
This fix:
eCLOSE_WAITtoeCLOSEDwhen SYN retries are exhaustedeCONNECT_SYN -> eCLOSEDtransition, ensuring connection state change callbacks are properly triggered.This also aligns the timeout behavior with the existing RST handling code, which correctly uses
eCLOSEDstate (see FreeRTOS_TCP_IP.c:859).Files changed:
Description
Test Steps
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.