From 865f314dd5ed55508f45a32973b709b79a541e36 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 11 Dec 2009 03:46:01 +0000 Subject: kdelibs update to Trinity v3.5.11 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1061230 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- dnssd/servicebrowser.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'dnssd/servicebrowser.cpp') diff --git a/dnssd/servicebrowser.cpp b/dnssd/servicebrowser.cpp index 017dc8102..542580c1b 100644 --- a/dnssd/servicebrowser.cpp +++ b/dnssd/servicebrowser.cpp @@ -23,14 +23,11 @@ #include #include #include "domainbrowser.h" +#include "responder.h" #include "query.h" #include "servicebrowser.h" +#include #include -#ifdef HAVE_DNSSD -#include -#endif - -#define MDNSD_PID "/var/run/mdnsd.pid" namespace DNSSD { @@ -85,20 +82,12 @@ ServiceBrowser::ServiceBrowser(const QString& type,const QString& domain,int fla const ServiceBrowser::State ServiceBrowser::isAvailable() { -#ifdef HAVE_DNSSD - QFile f(MDNSD_PID); - if (!f.open(IO_ReadOnly)) return Stopped; // no pidfile - QString line; - if (f.readLine(line,16)<1) return Stopped; - unsigned int pid = line.toUInt(); - if (pid==0) return Stopped; // not a pid - return (kill(pid,0)==0 || errno==EPERM) ? Working : Stopped; - // signal 0 only checks if process is running, mdnsd is probably owned by 'nobody' so we will - // get EPERM, if mdnsd is not running error will be ESRCH - + AvahiClientState s = Responder::self().state(); +#ifdef AVAHI_API_0_6 + return (s==AVAHI_CLIENT_FAILURE) ? Stopped : Working; #else - return Unsupported; -#endif + return (s==AVAHI_CLIENT_S_INVALID || s==AVAHI_CLIENT_DISCONNECTED) ? Stopped : Working; +#endif } ServiceBrowser::~ ServiceBrowser() { -- cgit v1.2.1