diff --git a/src/main.c b/src/main.c index 44991fd..05098c6 100644 --- a/src/main.c +++ b/src/main.c @@ -131,5 +131,8 @@ int main (int argc, char *argv[]) { g_main_loop_run (loop); + /* Detener la llegada de eventos */ + netlink_events_clear (&handle); + return 0; } diff --git a/src/netlink-events.c b/src/netlink-events.c index b9fb1b1..6a21b56 100644 --- a/src/netlink-events.c +++ b/src/netlink-events.c @@ -85,3 +85,15 @@ void netlink_events_setup (NetworkInadorHandle *handle) { handle->nl_sock_route_events = sock_req; } +void netlink_events_clear (NetworkInadorHandle *handle) { + /* Primero, detener los eventos del source watch */ + + g_source_remove (handle->route_events_source); + + handle->route_events_source = 0; + /* Cerrar el socket */ + + nl_close (handle->nl_sock_route_events); + handle->nl_sock_route_events = NULL; +} + diff --git a/src/netlink-events.h b/src/netlink-events.h index f231122..68bace6 100644 --- a/src/netlink-events.h +++ b/src/netlink-events.h @@ -26,5 +26,6 @@ #include "common.h" void netlink_events_setup (NetworkInadorHandle *handle); +void netlink_events_clear (NetworkInadorHandle *handle); #endif