diff --git a/server/src/network/webthrottleconnection.cpp b/server/src/network/webthrottleconnection.cpp index ad6eaa0e..4949f7b0 100644 --- a/server/src/network/webthrottleconnection.cpp +++ b/server/src/network/webthrottleconnection.cpp @@ -294,6 +294,8 @@ void WebThrottleConnection::sendMessage(const nlohmann::json& message) void WebThrottleConnection::sendError(uint32_t throttleId, std::string_view text, std::string_view tag) { + assert(isEventLoopThread()); + auto error = nlohmann::json::object(); error.emplace("event", "message"); error.emplace("throttle_id", throttleId); @@ -308,6 +310,8 @@ void WebThrottleConnection::sendError(uint32_t throttleId, std::string_view text void WebThrottleConnection::sendError(uint32_t throttleId, std::error_code ec) { + assert(isEventLoopThread()); + if(ec == TrainError::AlreadyAcquired) { sendError(throttleId, ec.message(), "already_acquired"); @@ -376,6 +380,8 @@ const std::shared_ptr& WebThrottleConnection::getThrottle(uint32_t void WebThrottleConnection::released(uint32_t throttleId) { + assert(isEventLoopThread()); + m_trainPropertyChanged.erase(throttleId); auto response = nlohmann::json::object();