Skip to content

Commit

Permalink
removeChildApp
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Sep 24, 2024
1 parent 12c4686 commit 17b8f95
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,18 @@ struct TemplatedApp {
return std::move(static_cast<BuilderPatternReturnType &&>(*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<BuilderPatternReturnType &&>(*this));
}

BuilderPatternReturnType &&addChildApp(BuilderPatternReturnType *app) {
/* Add this app to httpContextData list over child apps and set onPreOpen */
httpContext->getSocketContextData()->childApps.push_back((void *) app);
Expand Down

0 comments on commit 17b8f95

Please sign in to comment.