Skip to content

Commit

Permalink
lbrp addService fix (polycube-network#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReddaHawk committed Apr 22, 2021
1 parent 73dff9f commit 1f532d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/services/pcn-loadbalancer-rp/src/Lbrp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,16 @@ void Lbrp::addService(const std::string &vip, const uint16_t &vport,
"ICMP Service requires 0 as virtual port. Since this parameter is "
"useless for ICMP services");
}

Service::ServiceKey key =
Service::ServiceKey(vip, vport, Service::convertProtoToNumber(proto));
if (service_map_.count(key) != 0) {
logger()->error("[Service] This service already exists");
throw std::runtime_error("This service already exists");
}
Service service = Service(*this,conf);
service_map_.insert(std::make_pair(key,service));

}

void Lbrp::addServiceList(const std::vector<ServiceJsonObject> &conf) {
Expand Down

0 comments on commit 1f532d8

Please sign in to comment.