Skip to content

Commit

Permalink
Fixed ListenToSocketInternal so it works after Jellyfin 10.9.2 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-afk authored May 26, 2024
1 parent a4a681e commit c23e55c
Showing 1 changed file with 14 additions and 3 deletions.
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 @@ 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
{
localEndpointAdapter = allBindInterfaces.First(a => a.Index == result.PacketInformation.Interface);
}

ProcessMessage(
Encoding.UTF8.GetString(receiveBuffer, 0, result.ReceivedBytes),
Expand Down Expand Up @@ -509,7 +520,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 +546,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

0 comments on commit c23e55c

Please sign in to comment.