Skip to content

Commit 629db87

Browse files
Revert "adding debugging messages to QtCore"
This reverts commit ed174ba.
1 parent d98a3aa commit 629db87

8 files changed

+19
-71
lines changed

src/corelib/io/qnoncontiguousbytedevice.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)nullptr
9999

100100
QNonContiguousByteDevice::~QNonContiguousByteDevice()
101101
{
102-
printf("~QNonContiguousByteDevice %p (%s)\n", (void*)this, typeid(*this).name());
103102
}
104103

105104
QNonContiguousByteDeviceByteArrayImpl::QNonContiguousByteDeviceByteArrayImpl(QByteArray ba)

src/network/access/qhttp2connection.cpp

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include <algorithm>
1717
#include <memory>
18-
#include <thread>
1918

2019
QT_BEGIN_NAMESPACE
2120

@@ -44,7 +43,6 @@ QHttp2Stream::QHttp2Stream(QHttp2Connection *connection, quint32 streamID) noexc
4443
}
4544

4645
QHttp2Stream::~QHttp2Stream() noexcept {
47-
printf("~QHttp2Stream\n");
4846
if (auto *connection = getConnection()) {
4947
if (m_state == State::Open || m_state == State::HalfClosedRemote) {
5048
qCDebug(qHttp2ConnectionLog, "[%p] stream %u, destroyed while still open", connection,
@@ -292,7 +290,6 @@ bool QHttp2Stream::sendDATA(const QByteArray &payload, bool endStream)
292290
auto *byteDevice = QNonContiguousByteDeviceFactory::create(payload);
293291
m_owningByteDevice = true;
294292
byteDevice->setParent(this);
295-
printf("QHttp2Stream::sendDATA, byteDevice = %p\n", (void*)byteDevice);
296293
return sendDATA(byteDevice, endStream);
297294
}
298295

@@ -313,7 +310,6 @@ bool QHttp2Stream::sendDATA(const QByteArray &payload, bool endStream)
313310
*/
314311
bool QHttp2Stream::sendDATA(QIODevice *device, bool endStream)
315312
{
316-
printf("QHttp2Stream::sendDATA(QIODevice *%p, bool %d)\n", (void*)device, endStream);
317313
Q_ASSERT(!m_uploadDevice);
318314
Q_ASSERT(!m_uploadByteDevice);
319315
Q_ASSERT(device);
@@ -330,7 +326,6 @@ bool QHttp2Stream::sendDATA(QIODevice *device, bool endStream)
330326
m_owningByteDevice = true;
331327
byteDevice->setParent(this);
332328
m_uploadDevice = device;
333-
printf("QHttp2Stream::sendDATA, m_uploadDevice = %p, byteDevice = %p\n", (void*)device, (void*)byteDevice);
334329
return sendDATA(byteDevice, endStream);
335330
}
336331

@@ -351,7 +346,6 @@ bool QHttp2Stream::sendDATA(QIODevice *device, bool endStream)
351346
*/
352347
bool QHttp2Stream::sendDATA(QNonContiguousByteDevice *device, bool endStream)
353348
{
354-
printf("QHttp2Stream::sendDATA(QNonContiguousByteDevice *%p, bool %d)\n", (void*)device, endStream);
355349
Q_ASSERT(!m_uploadByteDevice);
356350
Q_ASSERT(device);
357351
if (m_state != State::Open && m_state != State::HalfClosedRemote) {
@@ -365,11 +359,8 @@ bool QHttp2Stream::sendDATA(QNonContiguousByteDevice *device, bool endStream)
365359
getConnection(), m_streamID, device);
366360
m_uploadByteDevice = device;
367361
m_endStreamAfterDATA = endStream;
368-
printf("QHttp2Stream::sendDATA, m_uploadByteDevice = %p\n", (void*)device);
369362
connect(m_uploadByteDevice, &QNonContiguousByteDevice::readyRead, this,
370363
&QHttp2Stream::maybeResumeUpload);
371-
auto functor = [p=m_uploadByteDevice](QObject*o){printf("m_uploadByteDevice %p destroyed %p\n",(void*)p, (void*)o);};
372-
QObject::connect(m_uploadByteDevice, &QObject::destroyed, m_uploadByteDevice, functor);
373364
connect(m_uploadByteDevice, &QObject::destroyed, this, &QHttp2Stream::uploadDeviceDestroyed);
374365

375366
internalSendDATA();
@@ -405,22 +396,17 @@ void QHttp2Stream::internalSendDATA()
405396
};
406397

407398
bool sentEND_STREAM = false;
408-
bool enteredFirstWhile = false;
409-
bool enteredSecondWhile = false;
410399
while (remainingWindowSize && deviceCanRead()) {
411-
enteredFirstWhile = true;
412400
quint32 bytesWritten = 0;
413401
qint32 remainingBytesInFrame = qint32(connection->maxFrameSize);
414402
frameWriter.start(FrameType::DATA, FrameFlag::EMPTY, streamID());
415403

416404
while (remainingWindowSize && deviceCanRead() && remainingBytesInFrame) {
417-
enteredSecondWhile = true;
418405
const qint32 maxToWrite = std::min(remainingWindowSize, remainingBytesInFrame);
419406

420407
qint64 outBytesAvail = 0;
421408
const char *readPointer = m_uploadByteDevice->readPointer(maxToWrite, outBytesAvail);
422409
if (!readPointer || outBytesAvail <= 0) {
423-
printf("not writing, readPointer: %s, outBytesAvail: %d\n", readPointer?"notnull":"null", (int)outBytesAvail);
424410
qCDebug(qHttp2ConnectionLog,
425411
"[%p] stream %u, cannot write data, device (%p) has %lld bytes available",
426412
connection, m_streamID, m_uploadByteDevice, outBytesAvail);
@@ -431,7 +417,6 @@ void QHttp2Stream::internalSendDATA()
431417
m_uploadByteDevice->advanceReadPointer(bytesToWrite);
432418

433419
bytesWritten += bytesToWrite;
434-
printf("bytesWritten: %d\n", (int)bytesWritten);
435420

436421
m_sendWindow -= bytesToWrite;
437422
Q_ASSERT(m_sendWindow >= 0);
@@ -450,47 +435,26 @@ void QHttp2Stream::internalSendDATA()
450435
frameWriter.addFlag(FrameFlag::END_STREAM);
451436
}
452437
if (!frameWriter.write(*socket)) {
453-
printf("failed to write to socket\n");
454438
qCDebug(qHttp2ConnectionLog, "[%p] stream %u, failed to write to socket", connection,
455439
m_streamID);
456440
return finishWithError(INTERNAL_ERROR, "failed to write to socket"_L1);
457441
}
458442

459443
totalBytesWritten += bytesWritten;
460444
}
461-
if(!enteredFirstWhile){
462-
printf("Did not enter first while, remainingWindowSize: %d, deviceCanRead(): %d\n", (int)remainingWindowSize, deviceCanRead());
463-
} else if(!enteredSecondWhile) {
464-
printf("Did not enter second while, remainingWindowSize: %d, deviceCanRead(): %d, remainingBytesInFrame: %d\n", (int)remainingWindowSize, deviceCanRead(), int(connection->maxFrameSize));
465-
}
466445

467446
qCDebug(qHttp2ConnectionLog,
468447
"[%p] stream %u, wrote %lld bytes total, if the device is not exhausted, we'll write "
469448
"more later. Remaining window size: %d",
470449
connection, m_streamID, totalBytesWritten, remainingWindowSize);
471450

472-
printf("emit totalBytesWritten(%d)\n", (int)totalBytesWritten);
473451
emit bytesWritten(totalBytesWritten);
474-
printf("sentEND_STREAM: %d\n", sentEND_STREAM);
475-
bool dcr;
476-
bool ae;
477-
if(!sentEND_STREAM) {
478-
dcr = deviceCanRead();
479-
printf("deviceCanRead(): %d\n", dcr);
480-
if(!dcr) {
481-
ae = m_uploadByteDevice->atEnd();
482-
printf("m_uploadByteDevice->atEnd(): %d\n", ae);
483-
}
484-
}
485-
if (sentEND_STREAM || (!dcr && ae)) {
486-
//qDebug(qHttp2ConnectionLog,
487-
// "[%p] stream %u, exhausted device %p, sent END_STREAM? %d, %ssending end stream "
488-
// "after DATA",
489-
// connection, m_streamID, m_uploadByteDevice, sentEND_STREAM,
490-
// m_endStreamAfterDATA ? "" : "not ");
491-
if(!sentEND_STREAM) {
492-
printf("m_endStreamAfterDATA: %d\n", m_endStreamAfterDATA);
493-
}
452+
if (sentEND_STREAM || (!deviceCanRead() && m_uploadByteDevice->atEnd())) {
453+
qCDebug(qHttp2ConnectionLog,
454+
"[%p] stream %u, exhausted device %p, sent END_STREAM? %d, %ssending end stream "
455+
"after DATA",
456+
connection, m_streamID, m_uploadByteDevice, sentEND_STREAM,
457+
m_endStreamAfterDATA ? "" : "not ");
494458
if (!sentEND_STREAM && m_endStreamAfterDATA) {
495459
// We need to send an empty DATA frame with END_STREAM since we
496460
// have exhausted the device, but we haven't sent END_STREAM yet.
@@ -501,17 +465,13 @@ void QHttp2Stream::internalSendDATA()
501465
}
502466
finishSendDATA();
503467
} else if (isUploadBlocked()) {
504-
printf("Upload is blocked\n");
505-
//qDebug(qHttp2ConnectionLog, "[%p] stream %u, upload blocked", connection, m_streamID);
468+
qCDebug(qHttp2ConnectionLog, "[%p] stream %u, upload blocked", connection, m_streamID);
506469
emit uploadBlocked();
507-
} else {
508-
printf("Upload is not blocked\n");
509470
}
510471
}
511472

512473
void QHttp2Stream::finishSendDATA()
513474
{
514-
printf("QHttp2Stream::finishSendDATA()\n");
515475
if (m_endStreamAfterDATA)
516476
transitionState(StateTransition::CloseLocal);
517477

@@ -633,9 +593,7 @@ void QHttp2Stream::sendWINDOW_UPDATE(quint32 delta)
633593

634594
void QHttp2Stream::uploadDeviceDestroyed()
635595
{
636-
printf("uploadDeviceDestroyed\n");
637596
if (isUploadingDATA()) {
638-
printf("isUploadingDATA is true\n");
639597
// We're in the middle of sending DATA frames, we need to abort
640598
// the stream.
641599
streamError(CANCEL, QLatin1String("Upload device destroyed while uploading"));
@@ -736,7 +694,6 @@ void QHttp2Stream::handleDATA(const Frame &inboundFrame)
736694
inboundFrame.dataSize());
737695
if (endStream)
738696
transitionState(StateTransition::CloseRemote);
739-
printf("dataReceived: `%s` endStream: %d\n", fragment.toStdString().c_str(), endStream);
740697
emit dataReceived(fragment, endStream);
741698
m_downloadBuffer.append(std::move(fragment));
742699
}
@@ -755,12 +712,6 @@ void QHttp2Stream::handleHEADERS(Http2::FrameFlags frameFlags, const HPack::Http
755712
if (endStream)
756713
transitionState(StateTransition::CloseRemote);
757714
if (!headers.empty()) {
758-
for(auto&h:headers){
759-
if( h.name.toStdString() == ":status"){
760-
printf("header ':status' %s received\n", h.value.toStdString().c_str());
761-
break;
762-
}
763-
}
764715
m_headers.insert(m_headers.end(), headers.begin(), headers.end());
765716
emit headersUpdated();
766717
}

src/network/access/qhttpthreaddelegate.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2016 The Qt Company Ltd.
22
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
33

4-
#define QHTTPTHREADDELEGATE_DEBUG
4+
//#define QHTTPTHREADDELEGATE_DEBUG
55
#include "qhttpthreaddelegate_p.h"
66

77
#include <QThread>
@@ -171,7 +171,6 @@ QThreadStorage<QNetworkAccessCache *> QHttpThreadDelegate::connections;
171171

172172
QHttpThreadDelegate::~QHttpThreadDelegate()
173173
{
174-
printf("~QHttpThreadDelegate\n");
175174
// It could be that the main thread has asked us to shut down, so we need to delete the HTTP reply
176175
if (httpReply) {
177176
delete httpReply;
@@ -182,7 +181,6 @@ QHttpThreadDelegate::~QHttpThreadDelegate()
182181
if (connections.hasLocalData() && !cacheKey.isEmpty()) {
183182
connections.localData()->releaseEntry(cacheKey);
184183
}
185-
printf("~QHttpThreadDelegate DONE\n");
186184
}
187185

188186

src/network/access/qhttpthreaddelegate_p.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ class QNonContiguousByteDeviceThreadForwardImpl : public QNonContiguousByteDevic
218218
m_pos += a;
219219

220220
// To main thread to inform about our state. The m_pos will be sent as a sanity check.
221-
printf("QNonContiguousByteDeviceThreadForwardImpl::advanceReadPointer, emit processedData(%d, %d)", (int)m_pos, (int)a);
222221
emit processedData(m_pos, a);
223222

224223
return true;
@@ -264,8 +263,6 @@ public slots:
264263
// From user thread:
265264
void haveDataSlot(qint64 pos, const QByteArray &dataArray, bool dataAtEnd, qint64 dataSize)
266265
{
267-
printf("QNonContiguousByteDeviceThreadForwardImpl::haveDataSlot(%d, dataArray with size %d, %d, %d)\n",
268-
(int)pos, (int)dataArray.size(), dataAtEnd, (int)dataSize);
269266
if (pos != m_pos) {
270267
// Sometimes when re-sending a request in the qhttpnetwork* layer there is a pending haveData from the
271268
// user thread on the way to us. We need to ignore it since it is the data for the wrong(later) chunk.
@@ -277,9 +274,6 @@ public slots:
277274
m_data = const_cast<char*>(m_dataArray.constData());
278275
m_amount = dataArray.size();
279276

280-
if(!m_atEnd && dataAtEnd) {
281-
printf("m_atEnd: false -> true\n");
282-
}
283277
m_atEnd = dataAtEnd;
284278
m_size = dataSize;
285279

src/network/access/qnetworkaccesscachebackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2016 The Qt Company Ltd.
22
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
33

4-
#define QNETWORKACCESSCACHEBACKEND_DEBUG
4+
//#define QNETWORKACCESSCACHEBACKEND_DEBUG
55

66
#include "qnetworkaccesscachebackend_p.h"
77
#include "qabstractnetworkcache.h"

src/network/access/qnetworkdiskcache.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2016 The Qt Company Ltd.
22
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
33

4-
#define QNETWORKDISKCACHE_DEBUG
4+
//#define QNETWORKDISKCACHE_DEBUG
55

66

77
#include "qnetworkdiskcache.h"
@@ -511,6 +511,13 @@ qint64 QNetworkDiskCache::expire()
511511
if (totalSize < goal)
512512
break;
513513
}
514+
#if defined(QNETWORKDISKCACHE_DEBUG)
515+
if (removedFiles > 0) {
516+
qDebug() << "QNetworkDiskCache::expire()"
517+
<< "Removed:" << removedFiles
518+
<< "Kept:" << cacheItems.count() - removedFiles;
519+
}
520+
#endif
514521
return totalSize;
515522
}
516523

src/network/access/qnetworkreplyhttpimpl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
33
// Qt-Security score:critical reason:network-protocol
44

5-
#define QNETWORKACCESSHTTPBACKEND_DEBUG
5+
//#define QNETWORKACCESSHTTPBACKEND_DEBUG
66

77
#include "qnetworkreplyhttpimpl_p.h"
88
#include "qnetworkaccessmanager_p.h"
@@ -1597,7 +1597,6 @@ void QNetworkReplyHttpImplPrivate::sentUploadDataSlot(qint64 pos, qint64 amount)
15971597
error(QNetworkReply::UnknownNetworkError, QString());
15981598
return;
15991599
}
1600-
printf("QNetworkReplyHttpImplPrivate::sentUploadDataSlot(%d, %d)\n",(int)pos,(int)amount);
16011600
uploadByteDevice->advanceReadPointer(amount);
16021601
uploadByteDevicePosition += amount;
16031602
}

src/network/socket/qtcpsocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2016 The Qt Company Ltd.
22
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
33

4-
#define QTCPSOCKET_DEBUG
4+
//#define QTCPSOCKET_DEBUG
55

66
/*!
77
\class QTcpSocket

0 commit comments

Comments
 (0)