Skip to content

Commit

Permalink
Providing a better choice of Network Interface (Azure#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
danigian authored Oct 28, 2021
1 parent 95a62f1 commit 96a71f0
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ public async Task InternalHandleDiscoveryAsync_ShouldSendProperJson(bool isHttps

// mocking localIpAddress
var connectionInfoMock = new Mock<ConnectionInfo>();
// this is going to select the network interface with most bytes received / sent
// this should correspond to the real ethernet/wifi interface on the machine
var firstNic = isValidNic ? NetworkInterface.GetAllNetworkInterfaces()
.OrderByDescending(x => x.GetIPv4Statistics().BytesReceived + x.GetIPv4Statistics().BytesSent)
.FirstOrDefault()
: null;
if (firstNic is not null)
Expand Down

0 comments on commit 96a71f0

Please sign in to comment.