base: Shutdown websocket server on unload

This commit is contained in:
tt2468 2021-04-27 15:25:11 -07:00
parent 20de7409d8
commit b61cf82e84
2 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,10 @@ class WebSocketServer : public QObject
void Stop();
void InvalidateSession(websocketpp::connection_hdl hdl);
bool IsListening() {
return _server.is_listening();
}
struct WebSocketState {
websocketpp::connection_hdl hdl;
std::string remoteAddress;

View File

@ -60,6 +60,12 @@ bool obs_module_load(void)
void obs_module_unload()
{
blog(LOG_INFO, "Shutting down...");
if (_webSocketServer->IsListening()) {
blog(LOG_INFO, "WebSocket server is running. Stopping...");
_webSocketServer->Stop();
}
_config.reset();
_webSocketServer.reset();
blog(LOG_INFO, "Finished shutting down.");