-
-
Notifications
You must be signed in to change notification settings - Fork 171
fix: Ignore remote peer aborts when accepting clients #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,6 +184,11 @@ private async Task<AcceptInfo> AcceptForListenerAsync(TcpListener listener, int | |
// Ignore the exception. This happens when the listener gets stopped. | ||
return new AcceptInfo(null, index); | ||
} | ||
catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Consider merging this filter with the existing exception handling to reduce duplication, e.g., using a combined filter: Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both blocks currently have different comments. Those would be hard to represent. |
||
{ | ||
// The remote peer closed the connection during the handshake process. We ignore these. | ||
return new AcceptInfo(null, index); | ||
} | ||
} | ||
|
||
private int StartListening(IEnumerable<IPAddress> addresses, int port) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Update the XML doc comment for
AcceptForListenerAsync
to explicitly note that aSocketError.ConnectionReset
(10054) is intentionally ignored so consumers understand why certain connection resets don’t bubble up.Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no XML doc on this method or on this line. Where would I put it? Add a new one on this private method, and then cascade to callers?
IMO, XML doc should match common practice of specifying which exceptions may be thrown, but the lib currently does not do that - does not include this even on exposed interfaces - AFAIK anway.