Migration support
[handlervirt.git] / node / main.c
blobfce15cfa92aa36983f5566da9ffafd963ab3ce7e
1 #include <stdio.h>
2 #include <stdlib.h>
4 #include <avahi-client/client.h>
5 #include <avahi-common/simple-watch.h>
6 #include <signal.h>
8 #include "node.h"
10 void terminate(int sig) {
11 if (offerServiceBrowser)
12 avahi_service_browser_free(offerServiceBrowser);
16 int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
17 /* Allocate main loop object */
18 if (!(simple_poll = avahi_simple_poll_new())) {
19 fprintf(stderr, "Failed to create simple poll object.\n");
20 goto fail;
23 /* The client that is going to do the work */
24 client_callback(NULL, AVAHI_CLIENT_FAILURE, NULL);
26 signal(SIGTERM, terminate);
28 /* Run the main loop */
29 avahi_simple_poll_loop(simple_poll);
31 fail:
32 /* Cleanup things */
33 if (simple_poll)
34 avahi_simple_poll_free(simple_poll);
36 exit(EXIT_SUCCESS);