diff options
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
| -rw-r--r-- | src/network/socket/qabstractsocket.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 975332a14ab..eb95d891e42 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1045,7 +1045,7 @@ void QAbstractSocketPrivate::_q_connectToNextAddress() host = addresses.takeFirst(); #if defined(QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::_q_connectToNextAddress(), connecting to %s:%i, %d left to try", - host.toString().toLatin1().constData(), port, addresses.count()); + host.toString().toLatin1().constData(), port, int(addresses.count())); #endif if (cachedSocketDescriptor == -1 && !initSocketLayer(host.protocol())) { @@ -1247,6 +1247,9 @@ void QAbstractSocketPrivate::emitReadyRead(int channel) void QAbstractSocketPrivate::emitBytesWritten(qint64 bytes, int channel) { Q_Q(QAbstractSocket); + + bytesWrittenEmissionCount++; + // Only emit bytesWritten() when not recursing. if (!emittedBytesWritten && channel == currentWriteChannel) { QScopedValueRollback<bool> r(emittedBytesWritten); @@ -2265,6 +2268,8 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) if (d->writeBuffer.isEmpty()) return false; + const quint32 bwEmissionCountAtEntry = d->bytesWrittenEmissionCount; + QDeadlineTimer deadline{msecs}; // handle a socket in connecting state @@ -2304,6 +2309,13 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) qDebug("QAbstractSocket::waitForBytesWritten returns true"); #endif return true; + } else if (d->bytesWrittenEmissionCount != bwEmissionCountAtEntry) { + // A slot connected to any signal emitted by this method has written data, which + // fulfills the condition to return true that at least one byte has been written. +#if defined (QABSTRACTSOCKET_DEBUG) + qDebug("QAbstractSocket::waitForBytesWritten returns true (write in signal handler)"); +#endif + return true; } } |
