mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
add UpstreamManager::upstream_delete() implementation
This commit is contained in:
@@ -147,6 +147,20 @@ int UpstreamManager::upstream_remove_server(const std::string& name,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int UpstreamManager::upstream_delete(const std::string& name)
|
||||
{
|
||||
WFNameService *ns = WFGlobal::get_name_service();
|
||||
auto *policy = ns->del_policy(name.c_str());
|
||||
|
||||
if (policy)
|
||||
{
|
||||
delete policy;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
UpstreamManager::upstream_main_address_list(const std::string& name)
|
||||
{
|
||||
|
||||
@@ -305,6 +305,9 @@ int main(int argc, char* argv[])
|
||||
|
||||
EXPECT_EQ(RUN_ALL_TESTS(), 0);
|
||||
|
||||
EXPECT_EQ(UpstreamManager::upstream_delete("try_another"), 1);
|
||||
EXPECT_EQ(UpstreamManager::upstream_delete("try_another"), 0);
|
||||
|
||||
http_server1.stop();
|
||||
http_server2.stop();
|
||||
http_server3.stop();
|
||||
|
||||
Reference in New Issue
Block a user