mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-20 04:20:48 +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) {
|
||||
schedulePausedShutdown();
|
||||
killAudioFocus();
|
||||
context.currentPlayer.pause();
|
||||
|
||||
if (context.currentPlayer != null) {
|
||||
context.currentPlayer.pause();
|
||||
}
|
||||
|
||||
setState(PlaybackState.Paused);
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "WebSocketServer.h"
|
||||
#include "Constants.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <core/sdk/constants.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
@ -334,8 +336,15 @@ void WebSocketServer::Broadcast(const std::string& name, json& options) {
|
||||
std::string str = msg.dump();
|
||||
|
||||
auto rl = connectionLock.Read();
|
||||
for (const auto &keyValue : this->connections) {
|
||||
wss->send(keyValue.first, str.c_str(), websocketpp::frame::opcode::text);
|
||||
try {
|
||||
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