[Development] API review for a new QDnsResolver class

Thiago Macieira thiago.macieira at intel.com
Wed Nov 9 10:00:46 CET 2011


On Wednesday, 9 de November de 2011 09:17:59 Jeremy Lainé wrote:
> On 11/08/2011 10:57 PM, Thiago Macieira wrote:
> > On Tuesday, 8 de November de 2011 19:40:13 Jeremy Lainé wrote:
> >> - the QNAM-style API seems to be OK
> > 
> > Correct, but all functions in QDnsResolver are static.
> > 
> > That means they could go into QDnsReply and we could rename the class
> > simply QDns. It worked for Qt 3...
> 
> The methods are not static, the QDnsResolver instance initially owns all
> QDnsReply objects it returns. It also owns the QThreadPool used to perform
> the lookups.

> > No need if all functions are static.
> 
> And since they are not?

They should be. There's no need for a QDnsResolver public object like 
QNetworkAccessManager. The idea of a manager in QNAM was to share settings, 
open connections and cookies. Usually, applications have only one QNAM and 
that's enough for them. However, in some circumstances, connections with 
different settings are necessary.

Not so for DNS: the are no settings to be changed. So all queries use the same 
settings and resources, which are shared behind the scenes. All lookup 
functions should be static returning QDnsReply*, or it should be able to 
create the lookup using QDnsReply's constructor.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111109/165c54c8/attachment.sig>


More information about the Development mailing list