[Kde-games-devel] setDiscoveryInfo ?
Jakub Stachowski
stachowski at hypair.net
Fri Aug 19 16:12:38 CEST 2005
Dnia piątek, 19 sierpnia 2005 15:15, Kleag napisał:
> It's more like that:
[ ... ]
> stat64("/home/gael/kde3.4.1/share/config/kdnssdrc", 0xbfffdb10) = -1 ENOENT
> (No such file or directory)
> socket(PF_FILE, SOCK_STREAM, 0) = 12
> connect(12, {sa_family=AF_FILE, path="/var/run/mdnsd"}, 110) = -1 ENOENT
> (No such file or directory)
> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
> rt_sigaction(SIGCHLD, NULL, {0xb7683ee0, [], SA_RESTART|SA_NOCLDSTOP}, 8) =
> 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> nanosleep({1, 0}, {1, 0}) = 0
> connect(12, {sa_family=AF_FILE, path="/var/run/mdnsd"}, 110) = -1 ENOENT
> (No such file or directory)
> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
> rt_sigaction(SIGCHLD, NULL, {0xb7683ee0, [], SA_RESTART|SA_NOCLDSTOP}, 8) =
> 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> nanosleep({1, 0}, {1, 0}) = 0
> connect(12, {sa_family=AF_FILE, path="/var/run/mdnsd"}, 110) = -1 ENOENT
> (No such file or directory)
> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
> rt_sigaction(SIGCHLD, NULL, {0xb7683ee0, [], SA_RESTART|SA_NOCLDSTOP}, 8) =
> 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> nanosleep({1, 0}, {1, 0}) = 0
> connect(12, {sa_family=AF_FILE, path="/var/run/mdnsd"}, 110) = -1 ENOENT
> (No such file or directory)
> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
> rt_sigaction(SIGCHLD, NULL, {0xb7683ee0, [], SA_RESTART|SA_NOCLDSTOP}, 8) =
> 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> nanosleep({1, 0}, {1, 0}) = 0
Yeah, it is libdns_sd doing idiotic thing - trying to connect to mdnsd over
and over despite it is not running. I commited a fix to 3.5 branch (i will
backport it to 3.4 too) that first checks if mdnsd is really running before
trying to make any publishing.
As a workaround for users with kdelibs 3.4.0-3.4.2 you can use following code
(from kdelibs/dnssd/servicebrowser.cpp) as a workaround:
bool dnssdAvailable() {
QFile f("/var/run/mdnsd.pid");
if (!f.open(IO_ReadOnly)) return false; // no pidfile
QString line;
if (f.readLine(line,16)<1) return false;
unsigned int pid = line.toUInt();
if (pid==0) return Stopped; // not a pid
return (kill(pid,0)==0 || errno==EPERM);
// 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
}
if (dnssdAvailable) setDiscoveryInfo("_ksirk._tcp");
More information about the kde-games-devel
mailing list