More cleanup
This commit is contained in:
parent
5510e8ebee
commit
848cfc32cc
|
@ -803,7 +803,6 @@ namespace Emby.Server.Implementations.HttpServer
|
|||
|
||||
private bool _disposed;
|
||||
private readonly object _disposeLock = new object();
|
||||
private readonly WebSocketSharpListener _websocketlistener;
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
|
|
|
@ -17,8 +17,6 @@ using Microsoft.Extensions.Logging;
|
|||
{
|
||||
public class WebSocketSharpListener : IHttpListener
|
||||
{
|
||||
private HttpListener _listener;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private CancellationTokenSource _disposeCancellationTokenSource = new CancellationTokenSource();
|
||||
|
@ -86,14 +84,14 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
do
|
||||
{
|
||||
result = await webSocketContext.ReceiveAsync(buffer, CancellationToken.None);
|
||||
result = await webSocketContext.ReceiveAsync(buffer, _disposeCancellationToken);
|
||||
socket.OnReceiveBytes(buffer.Array);
|
||||
message.AddRange(buffer.Array.Take(result.Count));
|
||||
} while (!result.EndOfMessage && result.MessageType != WebSocketMessageType.Close);
|
||||
|
||||
socket.OnReceiveBytes(message.ToArray());
|
||||
await webSocketContext.CloseAsync(result.CloseStatus ?? WebSocketCloseStatus.NormalClosure,
|
||||
result.CloseStatusDescription, CancellationToken.None);
|
||||
result.CloseStatusDescription, _disposeCancellationToken);
|
||||
socket.Dispose();
|
||||
}
|
||||
else
|
||||
|
@ -109,16 +107,9 @@ using Microsoft.Extensions.Logging;
|
|||
}
|
||||
}
|
||||
|
||||
public void Start(IEnumerable<string> urlPrefixes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task Stop()
|
||||
{
|
||||
_disposeCancellationTokenSource.Cancel();
|
||||
_listener?.Close();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user