[refactor] fix build warnings in avahi binding
This commit is contained in:
@@ -128,33 +128,33 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
|
||||
int error;
|
||||
int ret = 1;
|
||||
*/
|
||||
/* Allocate main loop object */
|
||||
/*if (!(simple_poll = avahi_simple_poll_new())) {
|
||||
/* Allocate main loop object */
|
||||
/*if (!(simple_poll = avahi_simple_poll_new())) {
|
||||
fprintf(stderr, "Failed to create simple poll object.\n");
|
||||
goto fail;
|
||||
}
|
||||
*/
|
||||
/* Allocate a new client */
|
||||
//client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error);
|
||||
/* Check wether creating the client object succeeded */
|
||||
/*if (!client) {
|
||||
/* Allocate a new client */
|
||||
//client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error);
|
||||
/* Check wether creating the client object succeeded */
|
||||
/*if (!client) {
|
||||
fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error));
|
||||
goto fail;
|
||||
}
|
||||
*//* Create the service browser */
|
||||
/*if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, browse_callback, client))) {
|
||||
/*if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, browse_callback, client))) {
|
||||
fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client)));
|
||||
goto fail;
|
||||
}
|
||||
*/
|
||||
/* Run the main loop */
|
||||
/* Run the main loop */
|
||||
/*
|
||||
|
||||
avahi_simple_poll_loop(simple_poll);
|
||||
ret = 0;
|
||||
fail:
|
||||
*/
|
||||
/* Cleanup things */
|
||||
/* Cleanup things */
|
||||
/*
|
||||
if (sb)
|
||||
avahi_service_browser_free(sb);
|
||||
@@ -163,14 +163,14 @@ fail:
|
||||
if (simple_poll)
|
||||
avahi_simple_poll_free(simple_poll);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
int run_avahi_service(TeleportPeer* peers) {
|
||||
int run_avahi_service(TeleportPeer *peers) {
|
||||
int error;
|
||||
peerList = peers;
|
||||
|
||||
/* Call this when the application starts up. */
|
||||
int error;
|
||||
|
||||
if (!(threaded_poll = avahi_threaded_poll_new())) {
|
||||
/* do something bad */
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef __BROWSER_H
|
||||
#define __BROWSER_H
|
||||
|
||||
|
||||
extern int run_avahi_service();
|
||||
void avahi_shutdown();
|
||||
extern int run_avahi_service(TeleportPeer *);
|
||||
void avahi_shutdown(void);
|
||||
|
||||
#endif /* __BROWSER_H */
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
/***
|
||||
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
|
||||
USA.
|
||||
***/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -38,7 +19,7 @@
|
||||
|
||||
#include "teleportapp.h"
|
||||
#include "teleportpeer.h"
|
||||
#include "browser.h"
|
||||
#include "publish.h"
|
||||
|
||||
static AvahiThreadedPoll *threaded_poll = NULL;
|
||||
static AvahiEntryGroup *group = NULL;
|
||||
@@ -83,7 +64,7 @@ static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state,
|
||||
|
||||
/* Some kind of failure happened while we were registering our services */
|
||||
//avahi_simple_poll_quit(simple_poll);
|
||||
avahi_shutdown();
|
||||
shutdown_avahi_publish_service();
|
||||
break;
|
||||
|
||||
case AVAHI_ENTRY_GROUP_UNCOMMITED:
|
||||
@@ -156,7 +137,7 @@ collision:
|
||||
|
||||
fail:
|
||||
//avahi_simple_poll_quit(simple_poll);
|
||||
avahi_shutdown();
|
||||
shutdown_avahi_publish_service();
|
||||
}
|
||||
|
||||
static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
|
||||
@@ -176,7 +157,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
|
||||
|
||||
fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c)));
|
||||
//avahi_simple_poll_quit(simple_poll);
|
||||
avahi_shutdown();
|
||||
shutdown_avahi_publish_service();
|
||||
|
||||
break;
|
||||
|
||||
@@ -203,7 +184,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
|
||||
}
|
||||
}
|
||||
|
||||
static void update_service(char * service_name) {
|
||||
extern void update_service(char * service_name) {
|
||||
avahi_free(name);
|
||||
name = avahi_strdup(service_name);
|
||||
|
||||
@@ -222,8 +203,6 @@ static void update_service(char * service_name) {
|
||||
|
||||
int run_avahi_publish_service(char * service_name) {
|
||||
int error;
|
||||
int ret = 1;
|
||||
struct timeval tv;
|
||||
|
||||
if (!(threaded_poll = avahi_threaded_poll_new())) {
|
||||
fprintf(stderr, "Failed to create threaded poll object.\n");
|
||||
@@ -246,11 +225,9 @@ int run_avahi_publish_service(char * service_name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void shutdown_avahi_publish_service(void) {
|
||||
/* Call this when the app shuts down */
|
||||
|
||||
//fprintf(stderr, "Some error\n");
|
||||
avahi_threaded_poll_stop(threaded_poll);
|
||||
avahi_client_free(client);
|
||||
avahi_threaded_poll_free(threaded_poll);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
extern int run_avahi_publish_service(char *);
|
||||
extern void shutdown_avahi_publish_service();
|
||||
extern void shutdown_avahi_publish_service(void);
|
||||
extern void update_service(char *);
|
||||
|
||||
#endif /* __PUBLISH_H */
|
||||
|
||||
Reference in New Issue
Block a user