aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Networking/NetworkManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-10-25 12:47:20 +0200
committerBond_009 <bond.009@outlook.com>2019-11-22 16:15:31 +0100
commitb477b3874ef8d79a1e27f8bb298d38443c3ec425 (patch)
tree9e2ce5032892e4c590cab63269081c413cbfdac7 /Emby.Server.Implementations/Networking/NetworkManager.cs
parent7846e9cb3cce026b81509454c8128cc7ca17c2f8 (diff)
Fix some warnings
Diffstat (limited to 'Emby.Server.Implementations/Networking/NetworkManager.cs')
-rw-r--r--Emby.Server.Implementations/Networking/NetworkManager.cs18
1 files changed, 12 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs
index d948dad68..098bd518e 100644
--- a/Emby.Server.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Server.Implementations/Networking/NetworkManager.cs
@@ -490,23 +490,25 @@ namespace Emby.Server.Implementations.Networking
IPAddress ipaddy;
int port = -1;
- //check if we have an IPv6 or ports
+ // check if we have an IPv6 or ports
if (values.Length <= 2) // ipv4 or hostname
{
port = values.Length == 1 ? defaultport : GetPort(values[1]);
- //try to use the address as IPv4, otherwise get hostname
+ // try to use the address as IPv4, otherwise get hostname
if (!IPAddress.TryParse(values[0], out ipaddy))
+ {
ipaddy = await GetIPfromHost(values[0]).ConfigureAwait(false);
+ }
}
- else if (values.Length > 2) //ipv6
+ else if (values.Length > 2) // ipv6
{
- //could [a:b:c]:d
+ //ncould [a:b:c]:d
if (values[0].StartsWith("[") && values[values.Length - 2].EndsWith("]"))
{
string ipaddressstring = string.Join(":", values.Take(values.Length - 1).ToArray());
ipaddy = IPAddress.Parse(ipaddressstring);
- port = GetPort(values[values.Length - 1]);
+ port = GetPort(values[^1]);
}
else //[a:b:c] or a:b:c
{
@@ -516,7 +518,11 @@ namespace Emby.Server.Implementations.Networking
}
else
{
- throw new FormatException(string.Format("Invalid endpoint ipaddress '{0}'", endpointstring));
+ throw new FormatException(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Invalid endpoint ipaddress '{0}'",
+ endpointstring));
}
if (port == -1)