diff options
| author | Vasily <JustAMan@users.noreply.github.com> | 2020-01-15 13:34:29 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-15 13:34:29 +0300 |
| commit | 3ab979c6ba6351c2c0cf2bd2030de2c1e6bdc92e (patch) | |
| tree | 4a5dda9b1e9ea4deed2c18714385d7fcd8dd473f /Emby.Server.Implementations/Net | |
| parent | c6484c0220968a6af2f526eef03e5d95cc7e12b3 (diff) | |
| parent | 665ca5cf1fcd6c757f214998d121e3f6a50fb8f3 (diff) | |
Merge pull request #2264 from Bond-009/discovery
Clean up server discovery code
Diffstat (limited to 'Emby.Server.Implementations/Net')
| -rw-r--r-- | Emby.Server.Implementations/Net/SocketFactory.cs | 29 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Net/UdpSocket.cs | 9 |
2 files changed, 0 insertions, 38 deletions
diff --git a/Emby.Server.Implementations/Net/SocketFactory.cs b/Emby.Server.Implementations/Net/SocketFactory.cs index 0870db003..4e04cde78 100644 --- a/Emby.Server.Implementations/Net/SocketFactory.cs +++ b/Emby.Server.Implementations/Net/SocketFactory.cs @@ -8,32 +8,6 @@ namespace Emby.Server.Implementations.Net { public class SocketFactory : ISocketFactory { - /// <summary> - /// Creates a new UDP acceptSocket and binds it to the specified local port. - /// </summary> - /// <param name="localPort">An integer specifying the local port to bind the acceptSocket to.</param> - public ISocket CreateUdpSocket(int localPort) - { - if (localPort < 0) - { - throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort)); - } - - var retVal = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); - - try - { - retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); - return new UdpSocket(retVal, localPort, IPAddress.Any); - } - catch - { - retVal?.Dispose(); - - throw; - } - } - public ISocket CreateUdpBroadcastSocket(int localPort) { if (localPort < 0) @@ -156,8 +130,5 @@ namespace Emby.Server.Implementations.Net throw; } } - - public Stream CreateNetworkStream(ISocket socket, bool ownsSocket) - => new NetworkStream(((UdpSocket)socket).Socket, ownsSocket); } } diff --git a/Emby.Server.Implementations/Net/UdpSocket.cs b/Emby.Server.Implementations/Net/UdpSocket.cs index dde4a2a34..211ca6784 100644 --- a/Emby.Server.Implementations/Net/UdpSocket.cs +++ b/Emby.Server.Implementations/Net/UdpSocket.cs @@ -181,15 +181,6 @@ namespace Emby.Server.Implementations.Net return taskCompletion.Task; } - public Task<SocketReceiveResult> ReceiveAsync(CancellationToken cancellationToken) - { - ThrowIfDisposed(); - - var buffer = new byte[8192]; - - return ReceiveAsync(buffer, 0, buffer.Length, cancellationToken); - } - public Task SendToAsync(byte[] buffer, int offset, int size, IPEndPoint endPoint, CancellationToken cancellationToken) { ThrowIfDisposed(); |
