Fix "QIODevice::read" warnings.
ClosedPublic

Authored by dfaure on Jan 26 2019, 10:04 PM.

Details

Summary

Calling readAll() after close() is just nonsense, QIODevice checks
the open status before reading, and warns (and returns -1) if closed.

False warnings make people start thinking in the wrong direction when
debugging an actual issue.

Test Plan

ctest --verbose -R sqlite-tagtest no longer has all these warnings.

Diff Detail

Repository
R165 Akonadi
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dfaure created this revision.Jan 26 2019, 10:04 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJan 26 2019, 10:04 PM
dfaure requested review of this revision.Jan 26 2019, 10:04 PM

For me this patch seems correct.
+1

dvratil requested changes to this revision.Jan 27 2019, 9:10 PM

The readAll()s after close() were needed IIRC, because reopening the socket and reading from it caused junk to be read from the buffer after reopening. This may have been caused by me doing something wrong. However, to make sure this does not keep happening, I'd suggest to always recreate the socket in doReconnect() instead of just reconnecting if it already exists.

This revision now requires changes to proceed.Jan 27 2019, 9:10 PM
dfaure updated this revision to Diff 50810.Feb 3 2019, 10:02 PM

Recreate socket as suggested

dvratil accepted this revision.Feb 5 2019, 11:56 AM

Thanks!

This revision is now accepted and ready to land.Feb 5 2019, 11:56 AM
This revision was automatically updated to reflect the committed changes.