mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
feat: improve websocket server shutdown process and enhance codec preset handling
This commit is contained in:
parent
5b45a5caa6
commit
30979f2b67
3 changed files with 21 additions and 3 deletions
|
|
@ -211,6 +211,14 @@ namespace PepperDash.Core
|
|||
public void StopServer()
|
||||
{
|
||||
Debug.Console(0, "Stopping Websocket Server");
|
||||
|
||||
_httpsServer.WebSocketServices[_path].Sessions.Broadcast("Server is stopping");
|
||||
|
||||
foreach (var session in _httpsServer.WebSocketServices[_path].Sessions.Sessions)
|
||||
{
|
||||
session.Context.WebSocket.Close(1001, "Server is stopping" );
|
||||
}
|
||||
|
||||
_httpsServer?.Stop();
|
||||
|
||||
_httpsServer = null;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|||
/// <param name="context"></param>
|
||||
protected override void HandlePost(HttpCwsContext context)
|
||||
{
|
||||
Debug.WebsocketSink.StopServer();
|
||||
|
||||
Task.Run(() => Debug.WebsocketSink.StopServer());
|
||||
|
||||
context.Response.StatusCode = 200;
|
||||
context.Response.StatusDescription = "OK";
|
||||
|
|
@ -98,6 +99,5 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|||
|
||||
Debug.LogMessage(LogEventLevel.Information, "Websocket Debug Session Stopped");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -922,8 +922,18 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
if (presetsCodec != null && Codec is IHasFarEndCameraControl &&
|
||||
(Codec as IHasFarEndCameraControl).ControllingFarEndCameraFeedback.BoolValue)
|
||||
{
|
||||
currentPresets = presetsCodec.FarEndRoomPresets;
|
||||
else if (presetsCodec != null) currentPresets = presetsCodec.NearEndPresets;
|
||||
}
|
||||
else if (presetsCodec != null)
|
||||
{
|
||||
currentPresets = presetsCodec.NearEndPresets;
|
||||
}
|
||||
|
||||
if (currentPresets == null)
|
||||
{
|
||||
return new List<CodecRoomPreset>();
|
||||
}
|
||||
|
||||
return currentPresets;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue