Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ListenToSocketInternal so it works after Jellyfin 10.9.2 #51

Merged
merged 3 commits into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/Rssdp/SsdpCommunicationsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,18 @@
if (result.ReceivedBytes > 0)
{
var remoteEndpoint = (IPEndPoint)result.RemoteEndPoint;
var localEndpointAdapter = _networkManager.GetAllBindInterfaces().First(a => a.Index == result.PacketInformation.Interface);
var allBindInterfaces = _networkManager.GetAllBindInterfaces();
IPData localEndpointAdapter;
if (allBindInterfaces.Count == 1
&& (allBindInterfaces[0].Address.Equals(IPAddress.Any)
|| allBindInterfaces[0].Address.Equals(IPAddress.IPv6Any)))
{
localEndpointAdapter = allBindInterfaces[0];
}
else
{
localEndpointAdapter = allBindInterfaces.First(a => a.Index == result.PacketInformation.Interface);
}
Comment on lines +419 to +428

Check notice

Code scanning / CodeQL

Missed ternary opportunity Note

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

ProcessMessage(
Encoding.UTF8.GetString(receiveBuffer, 0, result.ReceivedBytes),
Expand Down Expand Up @@ -509,7 +520,7 @@
LocalIPAddress = localIPAddress
});
}

private Socket CreateSsdpUdpSocket(IPData bindInterface, int localPort)
{
var interfaceAddress = bindInterface.Address;
Expand All @@ -535,7 +546,7 @@
throw;
}
}

private Socket CreateUdpMulticastSocket(IPAddress multicastAddress, IPData bindInterface, int multicastTimeToLive, int localPort)
{
var bindIPAddress = bindInterface.Address;
Expand Down
Loading