diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2017-01-10 15:54:52 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2017-01-10 15:54:52 +0100 |
commit | e9cd5a6826f198029ee466ae63d56dca4dfa4ad7 (patch) | |
tree | cb259a1fc5cbb2b8bef965ea0f968b056fefbd5d /iface.h | |
parent | 6281d3c3633fb1de98ff6010212325e45c226f3c (diff) |
llmnrd: merge rtnl interface event loop into main select() loops
Instead of spawming a thread for the sole purpose of watching the rtnl
for (presumably) seldom events, just merge the select() for all sockets
together in one single main loop.
This reduces unnecessary complexity and makes llmnrd no longer require
any locking.
It also allows us to handle signals in a thread-safe manner (as there
aren't any ;) and thus the race condition on exit reported in #20
Closes #20
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'iface.h')
-rw-r--r-- | iface.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 Tobias Klauser <tklauser@distanz.ch> + * Copyright (C) 2015-2017 Tobias Klauser <tklauser@distanz.ch> * * This file is part of llmnrd. * @@ -30,9 +30,9 @@ enum iface_event_type { typedef void (*iface_event_handler_t)(enum iface_event_type, unsigned char af, unsigned int ifindex); -void iface_register_event_handler(iface_event_handler_t event_handler); -int iface_start_thread(bool ipv6, const char *iface); -void iface_stop(void); +void iface_init(int sock, const char *iface, bool ipv6, + iface_event_handler_t event_handler); +void iface_recv(int sock); size_t iface_addr_lookup(unsigned int ifindex, unsigned char family, struct sockaddr_storage *addrs, size_t addrs_size); |