I had filed a bug, against QHttp and QFtp almost 6 or 7 years ago, right as 
QNAM came out, of course it was closed because "those classes were being 
deprecated for QNAM", to add a "setTimeout" to the request calls... :(

I would love to have this on QNetworkRequest...

-----Original Message-----
From: interest-bounces+scott.bloom=onshorecs....@qt-project.org 
[mailto:interest-bounces+scott.bloom=onshorecs....@qt-project.org] On Behalf Of 
Jason H
Sent: Monday, April 21, 2014 2:02 PM
To: Thiago Macieira; interest@qt-project.org
Subject: Re: [Interest] QNAM timeout is way too long

Well if you're going to the effort to create a timeout that isn't the 75s 
system timeout, why not make it a variable timeout? 

This is one of those "640k ought to be enough..." moments.  I can understand 
the rationale for Qt to set it the same on all platforms, so that you get 
consistent behavior. But if you're going to do that, you might as well make it 
a variable so its easier for the library user to leverage to their advantage.

You could have made that something like: connectTimer->start( 
qApp->network()->connectTimeout() ) then supported a method to set it. i.e. 
qApp->network()->setConnectTimeout(long ms);

As an aside, 
I'm rather amused that when QNAM became part of the API, (April 2008, now 6 
years ago) We've gone from wired/802.11g to 2G (150kbps and seconds-long pings) 
to 3G to LTE with 10s of Mbps and 10s of ms pings.  Qt was only targeting wired 
and wifi back then, now we're targeting wireless. Having a function manage the 
timeout would allow for each paradigm to targeted accordingly.


________________________________
From: Thiago Macieira <thiago.macie...@intel.com>
To: interest@qt-project.org 
Sent: Monday, April 21, 2014 4:14 PM
Subject: Re: [Interest] QNAM timeout is way too long


Em seg 21 abr 2014, às 12:19:21, Jason H escreveu:
> It should be 75 seconds on most platforms. You can blame that on ARPAnet.

QAbstractSocket has a 30 second timeout on DNS lookup + connection.

QAbstractSocketPrivate::_q_connectToNextAddress():
[http://code.woboq.org/qt5/qtbase/src/network/socket/qabstractsocket.cpp.html#1133]

        // Tries to connect to the address. If it succeeds immediately
        // (localhost address on BSD or any UDP connect), emit
        // connected() and return.
        if (socketEngine->connectToHost(host, port)) {
            //_q_testConnection();
            fetchConnectionParameters();
            return;
        }
[...]
        // Start the connect timer.
        if (threadData->hasEventDispatcher()) {
            if (!connectTimer) {
                connectTimer = new QTimer(q);
                QObject::connect(connectTimer, SIGNAL(timeout()),
                                 q, SLOT(_q_abortConnectionAttempt()),
                                 Qt::DirectConnection);
            }
            connectTimer->start(QT_CONNECT_TIMEOUT);
        }

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to