mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-02 21:24:15 -04:00
Removed debugging info
This commit is contained in:
parent
5b0c182908
commit
c07d8abfd5
@ -20,6 +20,7 @@ namespace Emby.Server.Implementations.Net
|
|||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
retVal.EnableBroadcast = true;
|
||||||
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
||||||
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
|
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ namespace Emby.Server.Implementations.Net
|
|||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
retVal.EnableBroadcast = true;
|
||||||
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
||||||
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 4);
|
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 4);
|
||||||
|
|
||||||
@ -68,7 +70,7 @@ namespace Emby.Server.Implementations.Net
|
|||||||
/// <param name="multicastTimeToLive">The multicast time to live value for the acceptSocket.</param>
|
/// <param name="multicastTimeToLive">The multicast time to live value for the acceptSocket.</param>
|
||||||
/// <param name="localPort">The number of the local port to bind to.</param>
|
/// <param name="localPort">The number of the local port to bind to.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort, ILogger _logger)
|
public ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort)
|
||||||
{
|
{
|
||||||
if (ipAddress == null)
|
if (ipAddress == null)
|
||||||
{
|
{
|
||||||
@ -90,8 +92,6 @@ namespace Emby.Server.Implementations.Net
|
|||||||
throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogError("Created");
|
|
||||||
|
|
||||||
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -103,8 +103,6 @@ namespace Emby.Server.Implementations.Net
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogError("Exclusive false");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// seeing occasional exceptions thrown on qnap
|
// seeing occasional exceptions thrown on qnap
|
||||||
@ -115,14 +113,9 @@ namespace Emby.Server.Implementations.Net
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogError("Reused");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
retVal.EnableBroadcast = true; // CHANGE
|
retVal.EnableBroadcast = true;
|
||||||
|
|
||||||
_logger.LogError("Broadcast");
|
|
||||||
|
|
||||||
// retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
|
// retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
|
||||||
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, multicastTimeToLive);
|
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, multicastTimeToLive);
|
||||||
|
|
||||||
@ -130,9 +123,6 @@ namespace Emby.Server.Implementations.Net
|
|||||||
|
|
||||||
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse(ipAddress), localIp));
|
retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse(ipAddress), localIp));
|
||||||
retVal.MulticastLoopback = true;
|
retVal.MulticastLoopback = true;
|
||||||
|
|
||||||
_logger.LogError("Sorted");
|
|
||||||
|
|
||||||
return new UdpSocket(retVal, localPort, localIp);
|
return new UdpSocket(retVal, localPort, localIp);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -23,9 +23,8 @@ namespace MediaBrowser.Model.Net
|
|||||||
/// <param name="ipAddress">The multicast IP address to bind to.</param>
|
/// <param name="ipAddress">The multicast IP address to bind to.</param>
|
||||||
/// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
|
/// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
|
||||||
/// <param name="localPort">The local port to bind to.</param>
|
/// <param name="localPort">The local port to bind to.</param>
|
||||||
/// <param name="logger"></param>
|
|
||||||
/// <returns>A <see cref="ISocket"/> implementation.</returns>
|
/// <returns>A <see cref="ISocket"/> implementation.</returns>
|
||||||
ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort, ILogger logger);
|
ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,12 +338,8 @@ namespace Rssdp.Infrastructure
|
|||||||
|
|
||||||
private ISocket ListenForBroadcastsAsync()
|
private ISocket ListenForBroadcastsAsync()
|
||||||
{
|
{
|
||||||
var socket = _SocketFactory.CreateUdpMulticastSocket(SsdpConstants.MulticastLocalAdminAddress, _MulticastTtl, SsdpConstants.MulticastPort, _logger);
|
var socket = _SocketFactory.CreateUdpMulticastSocket(SsdpConstants.MulticastLocalAdminAddress, _MulticastTtl, SsdpConstants.MulticastPort);
|
||||||
|
_ = ListenToSocketInternal(socket);
|
||||||
// TODO: remove this try and logging - testing purposes only.
|
|
||||||
_logger.LogError("Socket Created.");
|
|
||||||
|
|
||||||
_ = ListenToSocketInternal(socket, _logger);
|
|
||||||
|
|
||||||
return socket;
|
return socket;
|
||||||
}
|
}
|
||||||
@ -377,13 +373,13 @@ namespace Rssdp.Infrastructure
|
|||||||
|
|
||||||
foreach (var socket in sockets)
|
foreach (var socket in sockets)
|
||||||
{
|
{
|
||||||
_ = ListenToSocketInternal(socket, _logger);
|
_ = ListenToSocketInternal(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sockets;
|
return sockets;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ListenToSocketInternal(ISocket socket, ILogger logger)
|
private async Task ListenToSocketInternal(ISocket socket)
|
||||||
{
|
{
|
||||||
var cancelled = false;
|
var cancelled = false;
|
||||||
var receiveBuffer = new byte[8192];
|
var receiveBuffer = new byte[8192];
|
||||||
@ -396,7 +392,6 @@ namespace Rssdp.Infrastructure
|
|||||||
|
|
||||||
if (result.ReceivedBytes > 0)
|
if (result.ReceivedBytes > 0)
|
||||||
{
|
{
|
||||||
_logger.LogError("processing...");
|
|
||||||
// Strange cannot convert compiler error here if I don't explicitly
|
// Strange cannot convert compiler error here if I don't explicitly
|
||||||
// assign or cast to Action first. Assignment is easier to read,
|
// assign or cast to Action first. Assignment is easier to read,
|
||||||
// so went with that.
|
// so went with that.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user