mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-20 22:20:56 +00:00
A couple crasher fixes that were hiding behind the inability to
hot-restart the websocket server on the backend.
This commit is contained in:
parent
2140a9bc3e
commit
a42532136f
@ -228,7 +228,11 @@ public class StreamingPlaybackService implements PlaybackService {
|
|||||||
if (state != PlaybackState.Paused) {
|
if (state != PlaybackState.Paused) {
|
||||||
schedulePausedShutdown();
|
schedulePausedShutdown();
|
||||||
killAudioFocus();
|
killAudioFocus();
|
||||||
context.currentPlayer.pause();
|
|
||||||
|
if (context.currentPlayer != null) {
|
||||||
|
context.currentPlayer.pause();
|
||||||
|
}
|
||||||
|
|
||||||
setState(PlaybackState.Paused);
|
setState(PlaybackState.Paused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "WebSocketServer.h"
|
#include "WebSocketServer.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <core/sdk/constants.h>
|
#include <core/sdk/constants.h>
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
@ -334,8 +336,15 @@ void WebSocketServer::Broadcast(const std::string& name, json& options) {
|
|||||||
std::string str = msg.dump();
|
std::string str = msg.dump();
|
||||||
|
|
||||||
auto rl = connectionLock.Read();
|
auto rl = connectionLock.Read();
|
||||||
for (const auto &keyValue : this->connections) {
|
try {
|
||||||
wss->send(keyValue.first, str.c_str(), websocketpp::frame::opcode::text);
|
if (wss) {
|
||||||
|
for (const auto &keyValue : this->connections) {
|
||||||
|
wss->send(keyValue.first, str.c_str(), websocketpp::frame::opcode::text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
std::cerr << "broadcast failed (stale connection?)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user