3131#include < QTimer>
3232#include " qgslogger.h"
3333
34- static int NETWORK_TIMEOUT_MSEC = ( 120 * 1000 ); // 120 seconds
3534static int HTTP_PORT_DEFAULT = 80 ;
3635
3736// XXX Set the connection name when creating the provider instance
@@ -51,6 +50,13 @@ QgsHttpTransaction::QgsHttpTransaction( QString uri,
5150 httphost( proxyHost ),
5251 mError( 0 )
5352{
53+ QSettings s;
54+ mNetworkTimeoutMsec = s.value ( " /qgis/networkAndProxy/networkTimeout" , " 20000" ).toInt ();
55+ }
56+
57+ QgsHttpTransaction::QgsHttpTransaction ()
58+ {
59+
5460}
5561
5662QgsHttpTransaction::~QgsHttpTransaction ()
@@ -175,7 +181,7 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red
175181 this , SLOT ( networkTimedOut () ) );
176182
177183 mWatchdogTimer ->setSingleShot ( TRUE );
178- mWatchdogTimer ->start ( NETWORK_TIMEOUT_MSEC );
184+ mWatchdogTimer ->start ( mNetworkTimeoutMsec );
179185
180186 QgsDebugMsg ( " Starting get with id " + QString::number ( httpid ) + " ." );
181187 QgsDebugMsg ( " Setting httpactive = TRUE" );
@@ -251,7 +257,7 @@ void QgsHttpTransaction::dataHeaderReceived( const QHttpResponseHeader& resp )
251257 resp.value ( " Content-Type" ) + " '." );
252258
253259 // We saw something come back, therefore restart the watchdog timer
254- mWatchdogTimer ->start ( NETWORK_TIMEOUT_MSEC );
260+ mWatchdogTimer ->start ( mNetworkTimeoutMsec );
255261
256262 if ( resp.statusCode () == 302 ) // Redirect
257263 {
@@ -298,7 +304,7 @@ void QgsHttpTransaction::dataProgress( int done, int total )
298304// QgsDebugMsg("got " + QString::number(done) + " of " + QString::number(total));
299305
300306 // We saw something come back, therefore restart the watchdog timer
301- mWatchdogTimer ->start ( NETWORK_TIMEOUT_MSEC );
307+ mWatchdogTimer ->start ( mNetworkTimeoutMsec );
302308
303309 emit dataReadProgress ( done );
304310 emit totalSteps ( total );
@@ -414,7 +420,7 @@ void QgsHttpTransaction::dataStateChanged( int state )
414420 QgsDebugMsg ( " state " + QString::number ( state ) + " ." );
415421
416422 // We saw something come back, therefore restart the watchdog timer
417- mWatchdogTimer ->start ( NETWORK_TIMEOUT_MSEC );
423+ mWatchdogTimer ->start ( mNetworkTimeoutMsec );
418424
419425 switch ( state )
420426 {
@@ -467,7 +473,7 @@ void QgsHttpTransaction::networkTimedOut()
467473 QgsDebugMsg ( " entering." );
468474
469475 mError = tr ( " Network timed out after %n second(s) of inactivity.\n "
470- " This may be a problem in your network connection or at the WMS server." , " inactivity timeout" , NETWORK_TIMEOUT_MSEC / 1000 );
476+ " This may be a problem in your network connection or at the WMS server." , " inactivity timeout" , mNetworkTimeoutMsec / 1000 );
471477
472478 QgsDebugMsg ( " Setting httpactive = FALSE" );
473479 httpactive = FALSE ;
0 commit comments