Use reference count to close down idle network session
authorShane Kearns <ext-shane.2.kearns@nokia.com>
Fri, 27 Apr 2012 18:31:37 +0000 (19:31 +0100)
committerQt by Nokia <qt-info@nokia.com>
Sat, 5 May 2012 01:50:25 +0000 (03:50 +0200)
commit1aeaf0e7089c893a927a5ab311a6176aad5874a7
treef4f9244dc1b0fb6e3f7c0b4c4b0c3e771d1d06f7
parentcd7abae39ff586d98293d86c8295d53511878b58
Use reference count to close down idle network session

QNetworkAccessManager was using the AutoCloseConnection property
of QNetworkSession to close it when idle. However this property is
only implemented for polling engines and not event driven engines.

Instead, release the network session reference.
If another request comes in, it will be resurrected from the shared
session weak reference.
If not, then after 2 minutes when the connection caches are flushed
the ref count will reach zero and cause the QNetworkSession to be
destroyed (which closes it)

Task-number: QTBUG-15812
Change-Id: I2963bdf13fb02e3ac269489ea463669142f3c5f3
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
src/network/access/qnetworkaccessmanager.cpp