Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetHostEntryOrAddressesCore() [1/2]

static object System.Net.Dns.GetHostEntryOrAddressesCore ( IPAddress address,
bool justAddresses,
AddressFamily addressFamily,
ValueStopwatch stopwatch )
inlinestaticprivate

Definition at line 415 of file Dns.cs.

416 {
417 if (!stopwatch.IsActive)
418 {
419 stopwatch = NameResolutionTelemetry.Log.BeforeResolution(address);
420 }
421 string text;
422 try
423 {
424 text = NameResolutionPal.TryGetNameInfo(address, out var errorCode, out var nativeErrorCode);
425 if (errorCode != 0)
426 {
427 if (System.Net.NetEventSource.Log.IsEnabled())
428 {
429 System.Net.NetEventSource.Error(address, $"{address} DNS lookup failed with {errorCode}", "GetHostEntryOrAddressesCore");
430 }
432 }
433 }
434 catch when (LogFailure(stopwatch))
435 {
436 throw;
437 }
438 NameResolutionTelemetry.Log.AfterResolution(stopwatch, successful: true);
439 stopwatch = NameResolutionTelemetry.Log.BeforeResolution(text);
440 object result;
441 try
442 {
443 string hostName;
444 string[] aliases;
445 IPAddress[] addresses;
447 SocketError errorCode = NameResolutionPal.TryGetAddrInfo(text, justAddresses, addressFamily, out hostName, out aliases, out addresses, out nativeErrorCode2);
448 if (errorCode != 0 && System.Net.NetEventSource.Log.IsEnabled())
449 {
450 System.Net.NetEventSource.Error(address, $"forward lookup for '{text}' failed with {errorCode}", "GetHostEntryOrAddressesCore");
451 }
452 result = (justAddresses ? ((object)addresses) : ((object)new IPHostEntry
453 {
454 HostName = hostName,
455 Aliases = aliases,
456 AddressList = addresses
457 }));
458 }
459 catch when (LogFailure(stopwatch))
460 {
461 throw;
462 }
463 NameResolutionTelemetry.Log.AfterResolution(stopwatch, successful: true);
464 return result;
465 }
static bool LogFailure(ValueStopwatch stopwatch)
Definition Dns.cs:599
static SocketException CreateSocketException(SocketError errorCode, int platformError)
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)

References System.Net.Internals.SocketExceptionFactory.CreateSocketException(), System.Net.NetEventSource.Error(), System.Net.NetEventSource.Log, System.Net.NameResolutionTelemetry.Log, System.Net.Dns.LogFailure(), System.text, System.Net.NameResolutionPal.TryGetAddrInfo(), and System.Net.NameResolutionPal.TryGetNameInfo().