From 1f46cf2aa1a0a1c0d60cfaea63b572bd8a65a0cd Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 6 Jan 2010 10:05:09 +0100 Subject: QAbstractSocket: Warn when wrong QHostInfo was received Let's see if this happens. Reviewed-by: Thiago --- src/network/socket/qabstractsocket.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 8b4f364..0d35f2d 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -873,6 +873,10 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo) if (state != QAbstractSocket::HostLookupState) return; + if (hostLookupId != -1 && hostLookupId != hostInfo.lookupId()) { + qWarning("QAbstractSocketPrivate::_q_startConnecting() received hostInfo for wrong lookup ID %d expected %d", hostInfo.lookupId(), hostLookupId); + } + addresses = hostInfo.addresses(); #if defined(QABSTRACTSOCKET_DEBUG) -- cgit v0.12 From 65bbfb089672b5919c6c7f52956743ec0578af1c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 6 Jan 2010 10:08:32 +0100 Subject: QAbstractSocket: Fix warnings when compiling with QABSTRACTSOCKET_DEBUG --- src/network/socket/qabstractsocket.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 0d35f2d..fda47bd 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -520,13 +520,13 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc Q_Q(QAbstractSocket); #if defined (QABSTRACTSOCKET_DEBUG) QString typeStr; - if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = "TcpSocket"; - else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = "UdpSocket"; - else typeStr = "UnknownSocketType"; + if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = QLatin1String("TcpSocket"); + else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = QLatin1String("UdpSocket"); + else typeStr = QLatin1String("UnknownSocketType"); QString protocolStr; - if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = "IPv4Protocol"; - else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = "IPv6Protocol"; - else protocolStr = "UnknownNetworkLayerProtocol"; + if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = QLatin1String("IPv4Protocol"); + else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = QLatin1String("IPv6Protocol"); + else protocolStr = QLatin1String("UnknownNetworkLayerProtocol"); #endif resetSocketLayer(); @@ -880,12 +880,12 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo) addresses = hostInfo.addresses(); #if defined(QABSTRACTSOCKET_DEBUG) - QString s = "{"; + QString s = QLatin1String("{"); for (int i = 0; i < addresses.count(); ++i) { - if (i != 0) s += ", "; + if (i != 0) s += QLatin1String(", "); s += addresses.at(i).toString(); } - s += '}'; + s += QLatin1Char('}'); qDebug("QAbstractSocketPrivate::_q_startConnecting(hostInfo == %s)", s.toLatin1().constData()); #endif -- cgit v0.12