Loading src/eventhook.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ void p3::eventHook::event_worker() { } void p3::eventHook::handle_event(const std::array<std::string, 5>& args) { std::lock_guard<std::mutex> g(callback_mutex); for (auto c : callbacks) { c(args[0], args[1], args[2], args[3], args[4]); } Loading src/server.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -362,6 +362,8 @@ void p3::clientHandler::push_event( const std::string& a4, const std::string& a5 ) { if (!push_events_enabled) return; std::lock_guard<std::recursive_mutex> g(connection_write_mutex); try { Loading @@ -381,16 +383,16 @@ void p3::clientHandler::push_event( } connection.send(p3::protocol::ENDTEXT, "End Event", 1); } catch (p3::perror & e) { hook.unregister_callback(push_event_callback); push_events_enabled = false; std::thread t([this, e] () { std::lock_guard<std::recursive_mutex> g(connection_write_mutex); std::thread t([this, e] (auto evc) { try { hook.unregister_callback(evc); std::lock_guard<std::recursive_mutex> g(connection_write_mutex); connection.send(p3::protocol::ERROR, e.what() + std::string(" - Events disabled.")); } catch (p3::perror & e) { } catch (p3::perror &) { return; } }); }, push_event_callback); t.detach(); } } Loading Loading
src/eventhook.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ void p3::eventHook::event_worker() { } void p3::eventHook::handle_event(const std::array<std::string, 5>& args) { std::lock_guard<std::mutex> g(callback_mutex); for (auto c : callbacks) { c(args[0], args[1], args[2], args[3], args[4]); } Loading
src/server.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -362,6 +362,8 @@ void p3::clientHandler::push_event( const std::string& a4, const std::string& a5 ) { if (!push_events_enabled) return; std::lock_guard<std::recursive_mutex> g(connection_write_mutex); try { Loading @@ -381,16 +383,16 @@ void p3::clientHandler::push_event( } connection.send(p3::protocol::ENDTEXT, "End Event", 1); } catch (p3::perror & e) { hook.unregister_callback(push_event_callback); push_events_enabled = false; std::thread t([this, e] () { std::lock_guard<std::recursive_mutex> g(connection_write_mutex); std::thread t([this, e] (auto evc) { try { hook.unregister_callback(evc); std::lock_guard<std::recursive_mutex> g(connection_write_mutex); connection.send(p3::protocol::ERROR, e.what() + std::string(" - Events disabled.")); } catch (p3::perror & e) { } catch (p3::perror &) { return; } }); }, push_event_callback); t.detach(); } } Loading