call requestHandler in user code outside of the API lock
This commit is contained in:
parent
5adf483220
commit
bf03de68ac
|
@ -340,17 +340,23 @@ public:
|
||||||
virtual void setCalibrationValue(const String &name, double value){
|
virtual void setCalibrationValue(const String &name, double value){
|
||||||
api->setCalibrationValue(name,value);
|
api->setCalibrationValue(name,value);
|
||||||
}
|
}
|
||||||
virtual bool handleWebRequest(const String &url,AsyncWebServerRequest *req){
|
virtual bool handleWebRequest(const String &url, AsyncWebServerRequest *req)
|
||||||
GWSYNCHRONIZED(&localLock);
|
{
|
||||||
auto it=webHandlers.find(url);
|
GwApi::HandlerFunction handler;
|
||||||
if (it == webHandlers.end()){
|
{
|
||||||
api->getLogger()->logDebug(GwLog::LOG,"no web handler task=%s url=%s",name.c_str(),url.c_str());
|
GWSYNCHRONIZED(&localLock);
|
||||||
return false;
|
auto it = webHandlers.find(url);
|
||||||
|
if (it == webHandlers.end())
|
||||||
|
{
|
||||||
|
api->getLogger()->logDebug(GwLog::LOG, "no web handler task=%s url=%s", name.c_str(), url.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handler = it->second;
|
||||||
}
|
}
|
||||||
it->second(req);
|
if (handler)
|
||||||
|
handler(req);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GwUserCode::GwUserCode(GwApiInternal *api,SemaphoreHandle_t *mainLock){
|
GwUserCode::GwUserCode(GwApiInternal *api,SemaphoreHandle_t *mainLock){
|
||||||
|
|
Loading…
Reference in New Issue