Skip to content

Iocp.Send - guard AConnection.Close in the WSASend-failed path#185

Open
Vizit0r wants to merge 1 commit into
winddriver:masterfrom
Vizit0r:fix/iocp-send-failed-guard-nil-connection
Open

Iocp.Send - guard AConnection.Close in the WSASend-failed path#185
Vizit0r wants to merge 1 commit into
winddriver:masterfrom
Vizit0r:fix/iocp-send-failed-guard-nil-connection

Conversation

@Vizit0r
Copy link
Copy Markdown

@Vizit0r Vizit0r commented May 29, 2026

When WSASend fails synchronously (returns < 0 with an error other than WSA_IO_PENDING), the cleanup path freed the IO data, fired the failure callback, then called AConnection.Close unconditionally. In practice AConnection has been observed to be nil at that point, so the bare call AVs.

Guard the Close with Assigned(AConnection) so the failure path stays safe regardless of what the callback or earlier state did.

When WSASend fails synchronously (returns < 0 with an error other than WSA_IO_PENDING), the cleanup path freed the IO data, fired the failure
callback, then called AConnection.Close unconditionally. In practice AConnection has been observed to be nil at that point, so the bare call AVs.

Guard the Close with Assigned(AConnection) so the failure path stays safe regardless of what the callback or earlier state did.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant