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 2 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
16 changes: 13 additions & 3 deletions src/Rssdp/SsdpCommunicationsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,17 @@ private async Task ListenToSocketInternal(Socket socket)
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
crobibero marked this conversation as resolved.
Show resolved Hide resolved
{
localEndpointAdapter = allBindInterfaces.First(a => a.Index == result.PacketInformation.Interface);
}

ProcessMessage(
Encoding.UTF8.GetString(receiveBuffer, 0, result.ReceivedBytes),
Expand Down Expand Up @@ -509,7 +519,7 @@ private void OnResponseReceived(HttpResponseMessage data, IPEndPoint endPoint, I
LocalIPAddress = localIPAddress
});
}

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

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