summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-13 23:12:50 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-13 23:12:50 +0000
commit55296041473306ca4aa346197b60545814dfebe8 (patch)
treebb8b3d896ac2b93a080ce597cb42efa49d39b3bc
parent7484b62e1e00e551cd4b1a19507b98da698d4f7e (diff)
support time events with NULL timevals which are OK in avahi, but not in PA. This makes padevchooser actually work on top of the new avahi browsing stuff
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1076 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/pulsecore/avahi-wrap.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pulsecore/avahi-wrap.c b/src/pulsecore/avahi-wrap.c
index 9da76558..80256a12 100644
--- a/src/pulsecore/avahi-wrap.c
+++ b/src/pulsecore/avahi-wrap.c
@@ -139,7 +139,8 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
t->avahi_poll = p;
t->callback = callback;
t->userdata = userdata;
- t->time_event = p->mainloop->time_new(p->mainloop, tv, timeout_callback, t);
+
+ t->time_event = tv ? p->mainloop->time_new(p->mainloop, tv, timeout_callback, t) : NULL;
return t;
}
@@ -147,13 +148,21 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
assert(t);
- t->avahi_poll->mainloop->time_restart(t->time_event, tv);
+ if (t->time_event && tv)
+ t->avahi_poll->mainloop->time_restart(t->time_event, tv);
+ else if (!t->time_event && tv)
+ t->time_event = t->avahi_poll->mainloop->time_new(t->avahi_poll->mainloop, tv, timeout_callback, t);
+ else if (t->time_event && !tv) {
+ t->avahi_poll->mainloop->time_free(t->time_event);
+ t->time_event = NULL;
+ }
}
static void timeout_free(AvahiTimeout *t) {
assert(t);
- t->avahi_poll->mainloop->time_free(t->time_event);
+ if (t->time_event)
+ t->avahi_poll->mainloop->time_free(t->time_event);
pa_xfree(t);
}