Skip to content

Commit

Permalink
Merge pull request #120 from polycube-network/pr/fix_interface_deleti…
Browse files Browse the repository at this point in the history
…on_listener

Fix typos
  • Loading branch information
frisso committed May 10, 2019
2 parents 507acab + 7a8a614 commit def7cb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/polycubed/src/polycubed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::shared_ptr<spdlog::logger> logger;
// create core instance
PolycubedCore *core;
RestServer *restserver;
int netlink_nofitication_id = -1;
int netlink_notification_id = -1;

void shutdown() {
static bool done = false;
Expand All @@ -70,9 +70,9 @@ void shutdown() {
delete restserver;
}

if (netlink_nofitication_id != -1) {
if (netlink_notification_id != -1) {
Netlink::getInstance().unregisterObserver(Netlink::Event::LINK_DELETED,
netlink_nofitication_id);
netlink_notification_id);
}

logger->info("polycubed is shutting down. Bye!");
Expand Down Expand Up @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) {
core = new PolycubedCore(base_model);

// register handler to detect interfaces that are deleted
netlink_nofitication_id = Netlink::getInstance().registerObserver(
netlink_notification_id = Netlink::getInstance().registerObserver(
Netlink::Event::LINK_DELETED,
std::bind(&ServiceController::netlink_notification, std::placeholders::_1,
std::placeholders::_2));
Expand Down
6 changes: 6 additions & 0 deletions src/polycubed/src/service_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ bool ServiceController::parse_peer_name(const std::string &peer,
return true;
}

/*
* This function in on charge of setting the peer of ports
* connected to netdevs when they are removed.
* This function also removes the ExtIface object if this is
* not already removed.
*/
void ServiceController::netlink_notification(int ifindex,
const std::string &ifname) {
std::lock_guard<std::mutex> guard(service_ctrl_mutex_);
Expand Down

0 comments on commit def7cb5

Please sign in to comment.