diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-08-03 21:07:02 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-08-03 21:07:02 +0000 |
commit | 3a625af272ee8c6f878ba4d44ed1c741a1582395 (patch) | |
tree | ee5fb1f6bff53c670cede2882bbe69d408777894 /avahi-core/conformance-test.c | |
parent | 69ea921fa92b0b23faf0a955628e3afab5117534 (diff) |
* add C examples
* change doxygen to output stuff in "doxygen/" instead of "doxygen-doc/"
* implement avahi_entry_group_{reset,is_empty}() and make everyone use it
* move holdoff (SLEEPING) time checking from server to entry group
* add preliminary error codes
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@216 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/conformance-test.c')
-rw-r--r-- | avahi-core/conformance-test.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/avahi-core/conformance-test.c b/avahi-core/conformance-test.c index f8e0c93..ccc9a12 100644 --- a/avahi-core/conformance-test.c +++ b/avahi-core/conformance-test.c @@ -56,17 +56,15 @@ static void create_service(const gchar *t) { g_assert(t || name); - if (group) - avahi_entry_group_free(group); - n = t ? g_strdup(t) : avahi_alternative_service_name(name); g_free(name); name = n; - if (try > 10) - sleep(2); /* ugly ugly ugly hack */ + if (group) + avahi_entry_group_reset(group); + else + group = avahi_entry_group_new(avahi, entry_group_callback, NULL); - group = avahi_entry_group_new(avahi, entry_group_callback, NULL); avahi_server_add_service(avahi, group, 0, AF_UNSPEC, name, "_http._tcp", NULL, NULL, 80, "foo", NULL); avahi_entry_group_commit(group); @@ -94,14 +92,17 @@ static void entry_group_callback(AvahiServer *s, AvahiEntryGroup *g, AvahiEntryG static void server_callback(AvahiServer *s, AvahiServerState state, gpointer userdata) { avahi_log_debug("server state: %i", state); + + if (state == AVAHI_SERVER_RUNNING) { + create_service("gurke"); + avahi_server_dump(avahi, dump_line, NULL); + } } int main(int argc, char *argv[]) { GMainLoop *loop = NULL; avahi = avahi_server_new(NULL, NULL, server_callback, NULL); - create_service("gurke"); - avahi_server_dump(avahi, dump_line, NULL); loop = g_main_loop_new(NULL, FALSE); g_timeout_add(1000*5, dump_timeout, avahi); @@ -109,7 +110,8 @@ int main(int argc, char *argv[]) { g_main_loop_run(loop); g_main_loop_unref(loop); - avahi_entry_group_free(group); + if (group) + avahi_entry_group_free(group); avahi_server_free(avahi); return 0; |