From ff7cae8a13ce4bd5f158da840907a46ef2ad7d86 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Tue, 23 Feb 2021 17:06:40 +0000 Subject: [PATCH] renamed method --- Jellyfin.Networking/Manager/NetworkManager.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.cs index bd4b165b5d..9cb49ce685 100644 --- a/Jellyfin.Networking/Manager/NetworkManager.cs +++ b/Jellyfin.Networking/Manager/NetworkManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Net; @@ -693,7 +694,7 @@ namespace Jellyfin.Networking.Manager /// String to check. /// Interface index numbers that match. /// true if an interface name matches the token, False otherwise. - private bool IsInterface(string token, out List? index) + private bool TryIsInterface(string token, [NotNullWhen(true)] out List? index) { index = null; @@ -734,14 +735,14 @@ namespace Jellyfin.Networking.Manager { // Is it the name of an interface (windows) eg, Wireless LAN adapter Wireless Network Connection 1. // Null check required here for automated testing. - if (IsInterface(token, out var index)) + if (TryIsInterface(token, out var index)) { _logger.LogInformation("Interface {Token} used in settings. Using its interface addresses.", token); // Replace all the interface tags with the interface IP's. foreach (IPNetAddress iface in _interfaceAddresses) { - if (index!.Contains(Math.Abs(iface.Tag)) + if (index.Contains(Math.Abs(iface.Tag)) && ((IsIP4Enabled && iface.Address.AddressFamily == AddressFamily.InterNetwork) || (IsIP6Enabled && iface.Address.AddressFamily == AddressFamily.InterNetworkV6))) {