From c846c5d89b03aa3b479a2fa66a2f4e660b6d54a8 Mon Sep 17 00:00:00 2001 From: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:37:44 +0800 Subject: [PATCH] opt: log more info about the stream (#1858) * opt: log more info about the stream * opt: log more info about the stream * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/article_netmgr.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/article_netmgr.cc b/src/article_netmgr.cc index ee820eff..53d08962 100644 --- a/src/article_netmgr.cc +++ b/src/article_netmgr.cc @@ -380,14 +380,21 @@ qint64 ArticleResourceReply::readData( char * out, qint64 maxSize ) return finished ? -1 : 0; } - qint64 const left = avail - alreadyRead; qint64 const toRead = maxSize < left ? maxSize : left; if ( !toRead && finished ) { return -1; } - GD_DPRINTF( "====reading %d of (%lld) bytes . Finished: %d", (int)toRead, avail, finished ); + if ( toRead == 0 ) { + return 0; + } + + GD_DPRINTF( "====reading %lld of (%lld) bytes, %lld bytes readed . Finish status: %d", + toRead, + avail, + alreadyRead, + finished ); try { req->getDataSlice( alreadyRead, toRead, out );