-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix Dns.Resolve issue by using ContinueWith and AggregateException.Flatten #5260
Merged
Aaronontheweb
merged 15 commits into
akkadotnet:dev
from
Arkatufus:FIX_IO_DnsResolver_failure
Sep 7, 2021
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
02fed93
Fix Dns.Resolve issue by using ContinueWith and AggregateException.Fl…
Arkatufus 75be75a
Capture Sender as a local variable to scope it to local
Arkatufus a521c83
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Arkatufus fa18c21
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Aaronontheweb eca3079
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Arkatufus 0234295
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Arkatufus 84f9fcf
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Arkatufus 56102e0
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Aaronontheweb 9ac7180
Skip test in pipelines linux
Arkatufus 91f8749
Merge branch 'FIX_IO_DnsResolver_failure' of github.com:Arkatufus/akk…
Arkatufus b781760
Make Dns.Resolved forward all exceptions
Arkatufus a2b613c
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Arkatufus e15bd78
Revert Dns.Resolve property types
Arkatufus 6905cc7
Update API Approver list
Arkatufus acc713d
Merge branch 'dev' into FIX_IO_DnsResolver_failure
Arkatufus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,11 @@ | |
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Sockets; | ||
using System.Runtime.ExceptionServices; | ||
using Akka.Actor; | ||
using Akka.Configuration; | ||
using Akka.Routing; | ||
|
@@ -94,6 +96,11 @@ public class Resolved : Command | |
{ | ||
private readonly IPAddress _addr; | ||
|
||
public Resolved(string name, Exception ex) : this(name, null, null) | ||
{ | ||
Exception = ex; | ||
} | ||
|
||
/// <summary> | ||
/// TBD | ||
/// </summary> | ||
|
@@ -103,24 +110,28 @@ public class Resolved : Command | |
public Resolved(string name, IEnumerable<IPAddress> ipv4, IEnumerable<IPAddress> ipv6) | ||
{ | ||
Name = name; | ||
Ipv4 = ipv4; | ||
Ipv6 = ipv6; | ||
Ipv4 = ipv4?.ToImmutableList() ?? ImmutableList<IPAddress>.Empty; | ||
Ipv6 = ipv6?.ToImmutableList() ?? ImmutableList<IPAddress>.Empty; | ||
|
||
_addr = ipv4.FirstOrDefault() ?? ipv6.FirstOrDefault(); | ||
_addr = Ipv4.FirstOrDefault() ?? Ipv6.FirstOrDefault(); | ||
} | ||
|
||
public bool IsSuccess => Exception == null; | ||
|
||
public Exception Exception { get; } | ||
|
||
/// <summary> | ||
/// TBD | ||
/// </summary> | ||
public string Name { get; private set; } | ||
public string Name { get; } | ||
/// <summary> | ||
/// TBD | ||
/// </summary> | ||
public IEnumerable<IPAddress> Ipv4 { get; private set; } | ||
public IEnumerable<IPAddress> Ipv4 { get; } | ||
/// <summary> | ||
/// TBD | ||
/// </summary> | ||
public IEnumerable<IPAddress> Ipv6 { get; private set; } | ||
public IEnumerable<IPAddress> Ipv6 { get; } | ||
|
||
/// <summary> | ||
/// TBD | ||
|
@@ -129,8 +140,11 @@ public IPAddress Addr | |
{ | ||
get | ||
{ | ||
//TODO: Throw better exception | ||
if (_addr == null) throw new Exception("Unknown host"); | ||
if(Exception != null) | ||
ExceptionDispatchInfo.Capture(Exception).Throw(); | ||
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. Failed DNS resolve exception is being rethrown here |
||
else | ||
if (_addr == null) throw new Exception("Unknown host"); | ||
|
||
return _addr; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Need to add this new property to pass back exceptions from failed DNS resolve call