Apply review suggestions

This commit is contained in:
Shadowghost 2023-01-19 19:03:43 +01:00
parent 6954283af3
commit 6e46075414
2 changed files with 7 additions and 9 deletions

View file

@ -61,14 +61,10 @@ namespace Emby.Server.Implementations.Net
} }
/// <inheritdoc /> /// <inheritdoc />
public ISocket CreateUdpMulticastSocket(IPAddress ipAddress, IPAddress? bindIpAddress, int multicastTimeToLive, int localPort) public ISocket CreateUdpMulticastSocket(IPAddress ipAddress, IPAddress bindIpAddress, int multicastTimeToLive, int localPort)
{ {
ArgumentNullException.ThrowIfNull(ipAddress); ArgumentNullException.ThrowIfNull(ipAddress);
ArgumentNullException.ThrowIfNull(bindIpAddress);
if (bindIpAddress == null)
{
bindIpAddress = IPAddress.Any;
}
if (multicastTimeToLive <= 0) if (multicastTimeToLive <= 0)
{ {

View file

@ -336,13 +336,15 @@ namespace Rssdp.Infrastructure
private List<ISocket> ListenForBroadcasts() private List<ISocket> ListenForBroadcasts()
{ {
var sockets = new List<ISocket>(); var sockets = new List<ISocket>();
var nonNullBindAddresses = _networkManager.GetInternalBindAddresses().Where(x => x.Address != null);
if (_enableMultiSocketBinding) if (_enableMultiSocketBinding)
{ {
foreach (var address in _networkManager.GetInternalBindAddresses()) foreach (var address in nonNullBindAddresses)
{ {
if (address.AddressFamily == AddressFamily.InterNetworkV6) if (address.AddressFamily == AddressFamily.InterNetworkV6)
{ {
// Not support IPv6 right now // Not supporting IPv6 right now
continue; continue;
} }
@ -379,7 +381,7 @@ namespace Rssdp.Infrastructure
{ {
if (address.AddressFamily == AddressFamily.InterNetworkV6) if (address.AddressFamily == AddressFamily.InterNetworkV6)
{ {
// Not support IPv6 right now // Not supporting IPv6 right now
continue; continue;
} }