X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fupdate-test.c;h=feb884a02989f84ead31ab8320e267b20c5276d2;hb=9c0f9c65093cfa53d45f9b68782321eb8063a032;hp=8c5b5ed3b927eb6cbe1daf018f93e699da3fb19c;hpb=41f2725b37437a585ce285051bdae06f4919dc3b;p=catta diff --git a/avahi-core/update-test.c b/avahi-core/update-test.c index 8c5b5ed..feb884a 100644 --- a/avahi-core/update-test.c +++ b/avahi-core/update-test.c @@ -1,18 +1,16 @@ -/* $Id$ */ - /*** This file is part of avahi. - + avahi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + avahi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -24,12 +22,14 @@ #endif #include +#include #include #include #include #include #include +#include #include #include @@ -38,13 +38,13 @@ static AvahiSEntryGroup *group = NULL; -static void server_callback(AvahiServer *s, AvahiServerState state, void* userdata) { +static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) { + + avahi_log_debug("server state: %i", state); - avahi_log_debug("server state: %i", state); - if (state == AVAHI_SERVER_RUNNING) { int ret; - + group = avahi_s_entry_group_new(s, NULL, NULL); assert(group); @@ -55,15 +55,17 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void* userda } } -static void modify_txt_callback(AvahiTimeout *e, void *userdata) { +static void modify_txt_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata) { int ret; AvahiServer *s = userdata; + avahi_log_debug("modifying"); + ret = avahi_server_update_service_txt(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "foo", "_http._tcp", NULL, "test2", NULL); assert(ret == AVAHI_OK); } -int main(int argc, char *argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { AvahiSimplePoll *simple_poll; const AvahiPoll *poll_api; AvahiServer *server; @@ -72,7 +74,7 @@ int main(int argc, char *argv[]) { simple_poll = avahi_simple_poll_new(); assert(simple_poll); - + poll_api = avahi_simple_poll_get(simple_poll); assert(poll_api); @@ -82,7 +84,8 @@ int main(int argc, char *argv[]) { assert(server); avahi_server_config_free(&config); - poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 1000*20, 0), modify_txt_callback, server); + poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 1000*10, 0), modify_txt_callback, server); avahi_simple_poll_loop(simple_poll); + return 0; }