X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Fwatch-test.c;h=921a8f70f468647ea7c7af6b1b1f54e2335378e9;hb=fa8febc102b08ad9c5ff4732dfa5dbfda7361874;hp=af46805cdde0fd3739747f57f2889aeb29ad7ef8;hpb=4f0a5e7572a4257894b4bfede42c26d65152609e;p=catta diff --git a/avahi-common/watch-test.c b/avahi-common/watch-test.c index af46805..921a8f7 100644 --- a/avahi-common/watch-test.c +++ b/avahi-common/watch-test.c @@ -33,7 +33,7 @@ #include "simple-watch.h" #include "timeval.h" -static AvahiPoll *api = NULL; +static const AvahiPoll *api = NULL; static AvahiSimplePoll *simple_poll = NULL; static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdata) { @@ -52,7 +52,7 @@ static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdat } } -static void wakeup(AvahiPoll *_api, void *userdata) { +static void wakeup(AvahiTimeout *t, void *userdata) { static int i = 0; struct timeval tv; @@ -62,7 +62,7 @@ static void wakeup(AvahiPoll *_api, void *userdata) { avahi_simple_poll_quit(simple_poll); else { avahi_elapse_time(&tv, 1000, 0); - api->set_wakeup(api, &tv, wakeup, NULL); + api->timeout_update(t, &tv); } } @@ -75,12 +75,13 @@ int main(int argc, char *argv[]) { api->watch_new(api, 0, AVAHI_WATCH_IN, callback, NULL); avahi_elapse_time(&tv, 1000, 0); - api->set_wakeup(api, &tv, wakeup, NULL); + api->timeout_new(api, &tv, wakeup, NULL); /* Our main loop */ - for (;;) - if (avahi_simple_poll_iterate(simple_poll, -1) != 0) - break; + avahi_simple_poll_loop(simple_poll); + + + avahi_simple_poll_free(simple_poll); return 0; }