414 case QHttpNetworkRequest::NormalPriority: |
414 case QHttpNetworkRequest::NormalPriority: |
415 case QHttpNetworkRequest::LowPriority: |
415 case QHttpNetworkRequest::LowPriority: |
416 lowPriorityQueue.prepend(pair); |
416 lowPriorityQueue.prepend(pair); |
417 break; |
417 break; |
418 } |
418 } |
|
419 |
419 // this used to be called via invokeMethod and a QueuedConnection |
420 // this used to be called via invokeMethod and a QueuedConnection |
|
421 // It is the only place _q_startNextRequest is called directly without going |
|
422 // through the event loop using a QueuedConnection. |
|
423 // This is dangerous because of recursion that might occur when emitting |
|
424 // signals as DirectConnection from this code path. Therefore all signal |
|
425 // emissions that can come out from this code path need to |
|
426 // be QueuedConnection. |
|
427 // We are currently trying to fine-tune this. |
420 _q_startNextRequest(); |
428 _q_startNextRequest(); |
|
429 |
|
430 |
421 return reply; |
431 return reply; |
422 } |
432 } |
423 |
433 |
424 void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) |
434 void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) |
425 { |
435 { |
|
436 Q_Q(QHttpNetworkConnection); |
|
437 |
426 QHttpNetworkRequest request = pair.first; |
438 QHttpNetworkRequest request = pair.first; |
427 switch (request.priority()) { |
439 switch (request.priority()) { |
428 case QHttpNetworkRequest::HighPriority: |
440 case QHttpNetworkRequest::HighPriority: |
429 highPriorityQueue.prepend(pair); |
441 highPriorityQueue.prepend(pair); |
430 break; |
442 break; |
431 case QHttpNetworkRequest::NormalPriority: |
443 case QHttpNetworkRequest::NormalPriority: |
432 case QHttpNetworkRequest::LowPriority: |
444 case QHttpNetworkRequest::LowPriority: |
433 lowPriorityQueue.prepend(pair); |
445 lowPriorityQueue.prepend(pair); |
434 break; |
446 break; |
435 } |
447 } |
436 // this used to be called via invokeMethod and a QueuedConnection |
448 |
437 _q_startNextRequest(); |
449 QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); |
438 } |
450 } |
439 |
451 |
440 void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socket) |
452 void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socket) |
441 { |
453 { |
442 Q_ASSERT(socket); |
454 Q_ASSERT(socket); |
680 } |
692 } |
681 } |
693 } |
682 |
694 |
683 |
695 |
684 |
696 |
|
697 // This function must be called from the event loop. The only |
|
698 // exception is documented in QHttpNetworkConnectionPrivate::queueRequest |
685 void QHttpNetworkConnectionPrivate::_q_startNextRequest() |
699 void QHttpNetworkConnectionPrivate::_q_startNextRequest() |
686 { |
700 { |
687 //resend the necessary ones. |
701 //resend the necessary ones. |
688 for (int i = 0; i < channelCount; ++i) { |
702 for (int i = 0; i < channelCount; ++i) { |
689 if (channels[i].resendCurrent) { |
703 if (channels[i].resendCurrent) { |