-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
4.5.3, 4.8.3, 5.0.1
-
None
-
Tested on: Qt 5.0.1, Qt 4.8.3, Qt 4.5.3; probably all Qt 4.5+ are affected.
Linux sjinks 3.5.0-22-generic #34-Ubuntu SMP Tue Jan 8 21:47:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 12.10)
// See http://stackoverflow.com/a/904609/1046773
QHostAddress unrouteable(QLatin1String("255.255.255.0"));
QTcpSocket sock;
QSignalSpy spy(&sock, SIGNAL(error(QAbstractSocket::SocketError)));
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName(unrouteable.toString());
proxy.setPort(65000);
sock.setProxy(proxy);
QObject::connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
sock.connectToHost(QLatin1String("msn.com"), 80); // address and port do not matter here
// QT_CONNECT_TIMEOUT is 30 s, QAbstractSocket makes two connection attempts; add 1 minute more just to be safe.
QTestEventLoop::instance().enterLoop(60 + 60);
QVERIFY(spy.count() == 1); // Fails in Qt 4.5+; error() is never emitted
QVariantList res = spy.takeFirst();
#if QT_VERSION >= 0x040500
QCOMPARE(qvariant_cast<QAbstractSocket::SocketError>(res.at(0)), QAbstractSocket::ProxyConnectionTimeoutError);
#else
QCOMPARE(qvariant_cast<QAbstractSocket::SocketError>(res.at(0)), QAbstractSocket::ConnectionRefusedError);
#endif
Expected result: when proxy connection times out, error() signal should be emitted (just like in Qt 4.2 where this works).
Actual result: proxy connection times out silently, neither error() nor disconnected() nor stateChanged() signals are emitted.