From kde-core-devel Fri Mar 07 18:35:23 2008 From: Jakub Stachowski Date: Fri, 07 Mar 2008 18:35:23 +0000 To: kde-core-devel Subject: Re: [PATCH] Resolve Service address in DNSSD::RemoteService Message-Id: <200803071935.24229.stachowski () hypair ! net> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=120491485822576 Dnia czwartek, 6 marca 2008, Sebastian Trüg napisał: > On Thursday 06 March 2008 20:45:20 Jakub Stachowski wrote: > > Dnia czwartek, 6 marca 2008, Sebastian Trüg napisał: > > > Hi all, > > > > > > please find attached a patch for kdelibs/dnssd which adds handling of > > > service addresses. ATM we only get the hostname which is completely > > > useless in my network since I get stuff like "local.local". > > > > Why is it useless. There can be machine named 'local' after all. But if > > you then try to ping local.local. and there is lookup error then yes, > > something is broken. > > I don't know enough about this topic. I just wanted to make it work for me > and thought I shared. :) > The name lookups failed here and since avahi provides the address... this > seemed like the easy and logical solution. > > > > Address lookup was disabled via AVAHAI_LOOKUP_NO_ADDRESS. Why, I don't > > > know. > > > > I always treated hostname resolving as system resolver's job - in this > > case nss_mdnsd module. AFAIK recent glibc versions have this built-in. > > Why exactly? If Avahi already provides it... > > And how would I go about that? I tried to do the lookup via QHostInfo which > failed. > If this is a config problem I vote to work around it since IMHO the whole > point of something like Avahi is quick and simple connectivity. If I cannot > use that from a default Linux installation, what good is it? I don't have anything against it. > > > > Now the address is resolved and stored in ServiceBasePrivate, > > > accessible via the new address() method. I know that it would probably > > > make more sense to only store it in RemoteService but the design sees > > > it only as a trivial extension to ServiceBase without any new members. > > > > > > Any objections? > > > > Two things: > > 1) What about mdnsd? mdnsd-remoteservice.cpp is patched to use > > ResolveEvent::m_address which does not exist. In fact mdnsd does not seem > > to be capable of resolving service and its host name in one shot. So I > > guess when resolve_callback gets called it has to first resolve hostname > > and only then emit resolved(true) > > stupid me. I added that and was happy that it compiled. I never thought > about the fact that on my avahi-based system the mdns code would never get > compiled. :( It's still needed for macosx and windows compatibility. Actually I wonder if anybody tested in on these platforms. > > > 2) Why use QString as type address? I think more specific type like > > QHostAddress would be better. > > Correct. I just used QString because it is used by the DBus interface > (naturally) and it was the fast solution. > In the end the main goal was to get this discussion started. That is always > simpler with some code to debate about. ;) > QHost address has constructor taking QString so additional work will be minimal anyway. > Cheers, > Sebastian