[Qt-interest] Concurrent qnetworkrequest's to same domain

Thiago Macieira thiago.macieira at trolltech.com
Wed Jul 22 17:28:26 CEST 2009


Em Quarta-feira 22 Julho 2009, às 16:30:43, Marcus Williams escreveu:
> > 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.
>
> Not sure what you mean here. I create the networkrequest in the
> downloadmanager thread directly:
>
> QNetworkRequest request;
> .. set up headers...
> QNetworkReply *reply = m_netManager->get(request);
>
> So request and reply are owned by the download manager thread arent they?

Yes. The question is: what thread is that?

Which thread did you write this in?
	m_netManager = new QNetworkAccessManager;

The creation of QNetworkAccessManager and the use of all its replies must 
happen in the same thread. You can move the manager, but only if it has just 
been created (no replies running).

> > We're also working on a priority concept which would allow QNAM to
> override
> > the socket limit and open a new connection.
>
> This is probably what I'm looking for now :)
>
> Is the max connection limit hackable if we build qt from scratch (we do
> this already, so if its a simple change this might be the easiest).

Yes, it is. In Qt 4.6, you can change the value from 6 to anything you want.

In Qt 4.5, it makes a few assumptions about being only 2. You'll have to 
correct those assumptions (which is what we did just prior to increasing it to 
6).

We still haven't decided whether allowing fine-tuning is a feature we want. 
Instead, I prefer the "bypass the limit" high-priority request.

Of course, if you have 6 high-priority requests running, no normal-priority 
requests will run.

That's an interesting discussion we're having here: are downloads high 
priority or low priority? I thought they were high priority, because you want 
them to start as soon as possible, since they take long time to complete. 
However, like I said above, if you have 6 or more downloads from the same 
server, you won't be able to see any webpages: no normal-priority requests 
would be handled.

I have now changed my opinion to being that a download is a low-priority and 
usually confined to the background anyway. So it doesn't matter that it takes 
20 seconds more for it to start, while the last images of this webpage are 
loaded.

Another feature for low-priority items would be that they can never use all 
sockets. So a normal-priority request will always get served immediately if 
there are only low-priority requests processing.

-- 
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/4db89879/attachment.bin 


More information about the Qt-interest-old mailing list