-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Making LookupClient disposable and improved TCP client pool #220
base: dev
Are you sure you want to change the base?
Conversation
Making LookupClient disposable. Disposing tcp client pool properly.
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.
A couple of remarks. Since this is a significant breaking change, I would recommend to signal it to the package consumers by a major version bump.
} | ||
catch (Exception) when (gotCanceled) | ||
{ | ||
throw new TimeoutException("Connection timed out."); |
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.
The caller Query
method doesn't seem to translate cancellations to TimeoutException
.
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.
Not exactly sure what you mean by that.
What I want to do here is allowing LookupClient does handle OperationCanceled- and Timeout-Exceptions and retry the request if possible.
For TCP, if the connection attempt takes longer then the configured timeout for a query, I want to handle it the same way and maybe have LookupClient retry.
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.
changed both, sync and async version to throw new OperationCanceledException("Connection timed out.", cancellationToken);
Still, its mostly a signal for LookupClient to retry
} | ||
catch (Exception) when (gotCanceled) | ||
{ | ||
throw new TimeoutException("Connection timed out."); |
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.
Since this method is async, it shouldn't be translated to TimeoutException
.
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.
I'll change both, the sync and async version to throw new OperationCanceledException("Connection timed out.", cancellationToken);
Making LookupClient and DnsMessageHandlers disposable.
Primarily to dispose the TcpClient-pool.
The pool could be empty if the TCP fallback was either disabled or never used, so it is not always necessary to dispose the LookupClient owning that resource.