From da37a33d47e36050ee6da729aca182cf78b1d0bd Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 24 Jul 2017 11:08:19 +0200 Subject: [PATCH] Fixed API calls not taking immediate effect, fixed UDP API not locking config --- src/controller/controller_api.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controller/controller_api.cpp b/src/controller/controller_api.cpp index 20eb47d9..a7bf31f6 100644 --- a/src/controller/controller_api.cpp +++ b/src/controller/controller_api.cpp @@ -202,6 +202,7 @@ void Controller::handleUDPAPI(void * np){ Request["minimal"] = true; JSON::Value Response; if (Request.isObject()){ + tthread::lock_guard guard(configMutex); handleAPICommands(Request, Response); }else{ WARN_MSG("Invalid API command received over UDP: %s", uSock.data); @@ -632,6 +633,7 @@ void Controller::handleAPICommands(JSON::Value & Request, JSON::Value & Response } - Controller::configChanged = true; + Controller::writeConfig(); + Controller::configChanged = false; }