mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
Fix CA1851
This commit is contained in:
parent
656a0bff6f
commit
343a94f185
|
@ -564,13 +564,13 @@ namespace Jellyfin.Networking.Manager
|
||||||
if (_interfaces != null)
|
if (_interfaces != null)
|
||||||
{
|
{
|
||||||
// Match all interfaces starting with names starting with token
|
// Match all interfaces starting with names starting with token
|
||||||
var matchedInterfaces = _interfaces.Where(s => s.Name.Equals(intf, StringComparison.OrdinalIgnoreCase)).OrderBy(x => x.Index);
|
var matchedInterfaces = _interfaces.Where(s => s.Name.Equals(intf, StringComparison.OrdinalIgnoreCase)).OrderBy(x => x.Index).ToList();
|
||||||
if (matchedInterfaces.Any())
|
if (matchedInterfaces.Any())
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Interface {Token} used in settings. Using its interface addresses.", intf);
|
_logger.LogInformation("Interface {Token} used in settings. Using its interface addresses.", intf);
|
||||||
|
|
||||||
// Use interface IP instead of name
|
// Use interface IP instead of name
|
||||||
foreach (IPData iface in matchedInterfaces)
|
foreach (var iface in matchedInterfaces)
|
||||||
{
|
{
|
||||||
if ((IsIpv4Enabled && iface.Address.AddressFamily == AddressFamily.InterNetwork)
|
if ((IsIpv4Enabled && iface.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||||
|| (IsIpv6Enabled && iface.Address.AddressFamily == AddressFamily.InterNetworkV6))
|
|| (IsIpv6Enabled && iface.Address.AddressFamily == AddressFamily.InterNetworkV6))
|
||||||
|
@ -746,7 +746,8 @@ namespace Jellyfin.Networking.Manager
|
||||||
// Get the first LAN interface address that's not excluded and not a loopback address.
|
// Get the first LAN interface address that's not excluded and not a loopback address.
|
||||||
var availableInterfaces = _interfaces.Where(x => !IPAddress.IsLoopback(x.Address))
|
var availableInterfaces = _interfaces.Where(x => !IPAddress.IsLoopback(x.Address))
|
||||||
.OrderByDescending(x => IsInLocalNetwork(x.Address))
|
.OrderByDescending(x => IsInLocalNetwork(x.Address))
|
||||||
.ThenBy(x => x.Index);
|
.ThenBy(x => x.Index)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (availableInterfaces.Any())
|
if (availableInterfaces.Any())
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ public static class WebHostBuilderExtensions
|
||||||
var addresses = appHost.NetManager.GetAllBindInterfaces();
|
var addresses = appHost.NetManager.GetAllBindInterfaces();
|
||||||
|
|
||||||
bool flagged = false;
|
bool flagged = false;
|
||||||
foreach (IPObject netAdd in addresses)
|
foreach (var netAdd in addresses)
|
||||||
{
|
{
|
||||||
logger.LogInformation("Kestrel listening on {Address}", IPAddress.IPv6Any.Equals(netAdd.Address) ? "All Addresses" : netAdd);
|
logger.LogInformation("Kestrel listening on {Address}", IPAddress.IPv6Any.Equals(netAdd.Address) ? "All Addresses" : netAdd);
|
||||||
options.Listen(netAdd.Address, appHost.HttpPort);
|
options.Listen(netAdd.Address, appHost.HttpPort);
|
||||||
|
|
Loading…
Reference in a new issue