[Interest] QNAM timeout is way too long

Jason H scorp1us at yahoo.com
Mon Apr 21 23:02:05 CEST 2014


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.macieira at intel.com>
To: interest at 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 at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list