diff --git a/src/App.h b/src/App.h index c16798e95..db916822a 100644 --- a/src/App.h +++ b/src/App.h @@ -576,6 +576,18 @@ struct TemplatedApp { return std::move(static_cast(*this)); } + BuilderPatternReturnType &&removeChildApp(BuilderPatternReturnType *app) { + /* Remove this app from httpContextData list over child apps and reset round robin */ + auto &childApps = httpContext->getSocketContextData()->childApps; + childApps.erase( + std::remove(childApps.begin(), childApps.end(), (void *) app), + childApps.end() + ); + httpContext->getSocketContextData()->roundRobin = 0; + + return std::move(static_cast(*this)); + } + BuilderPatternReturnType &&addChildApp(BuilderPatternReturnType *app) { /* Add this app to httpContextData list over child apps and set onPreOpen */ httpContext->getSocketContextData()->childApps.push_back((void *) app);