[Qt-interest] Concurrent qnetworkrequest's to same domain
Thiago Macieira
thiago.macieira at trolltech.com
Wed Jul 22 15:56:43 CEST 2009
Em Quarta-feira 22 Julho 2009, às 14:44:27, Marcus Williams escreveu:
> Hi -
>
> Reading around the docs and qt blog on QNetworkAccessManager I see that
> it obeys the http spec in limiting outgoing connections to a max of 2
> per domain.
We've just changed that to 6 in Qt 4.6.
> If I want to bump this up does the act of using more than
> one get around this limit (so do I get 2 per manager) or is this 2
> outgoing connections to a single domain shared across all managers?
The limit is per manager. Managers don't talk to each other.
But you shouldn't have more than one manager, since they won't share other
things like cookies and proxy settings.
> I have a download manager thread in a client talking to a single assets
> server. It uses a single networkaccessmanager object. All download
> requests are queued up as network requests on this object and the thread
> deals with the download signals as required.
I'd say the thread is completely redundant. But separate managers is the only
way to have multiple threads.
The "one manager per application" recommendation still applies though.
> If I can bump the concurrency up by having a pool of
> networkaccessmanagers that I push requests to this would be great, but
> my worry then is whether the signals I get from the network managers are
> thread safe. So if I connect all the qnetworkreply::finished() signals
> to the same slot in my download manager thread would I ever get a
> finished() signal during the processing of another networkaccessmanagers
> finished() signal?
The signals are thread-safe.
Accessing the objects isn't. You can only access it from the thread that they
were created in (the QNetworkAccessManager thread). You can't moveToThread.
Which is why you shouldn't use threads to deal with QNAM.
We're also working on a priority concept which would allow QNAM to override
the socket limit and open a new connection.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090722/5c066277/attachment.bin
More information about the Qt-interest-old
mailing list