Fix code issues

This commit is contained in:
gion
2020-05-26 11:37:52 +02:00
parent e4838b0faa
commit e42bfc92f3
6 changed files with 19 additions and 48 deletions

View File

@@ -87,13 +87,13 @@ namespace Emby.Server.Implementations.Session
httpServer.WebSocketConnected += OnServerManagerWebSocketConnected;
}
private void OnServerManagerWebSocketConnected(object sender, GenericEventArgs<IWebSocketConnection> e)
private async void OnServerManagerWebSocketConnected(object sender, GenericEventArgs<IWebSocketConnection> e)
{
var session = GetSession(e.Argument.QueryString, e.Argument.RemoteEndPoint.ToString());
if (session != null)
{
EnsureController(session, e.Argument);
KeepAliveWebSocket(e.Argument);
await KeepAliveWebSocket(e.Argument);
}
else
{
@@ -149,7 +149,7 @@ namespace Emby.Server.Implementations.Session
/// <param name="e">The event arguments.</param>
private void OnWebSocketClosed(object sender, EventArgs e)
{
var webSocket = (IWebSocketConnection) sender;
var webSocket = (IWebSocketConnection)sender;
_logger.LogDebug("WebSocket {0} is closed.", webSocket);
RemoveWebSocket(webSocket);
}
@@ -158,7 +158,7 @@ namespace Emby.Server.Implementations.Session
/// Adds a WebSocket to the KeepAlive watchlist.
/// </summary>
/// <param name="webSocket">The WebSocket to monitor.</param>
private void KeepAliveWebSocket(IWebSocketConnection webSocket)
private async Task KeepAliveWebSocket(IWebSocketConnection webSocket)
{
lock (_webSocketsLock)
{
@@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.Session
// Notify WebSocket about timeout
try
{
SendForceKeepAlive(webSocket).Wait();
await SendForceKeepAlive(webSocket);
}
catch (WebSocketException exception)
{