PragmaTwice commented on code in PR #3077: URL: https://github.com/apache/kvrocks/pull/3077#discussion_r2249926518
########## src/common/io_util.cc: ########## @@ -322,6 +322,39 @@ StatusOr<std::string> SockReadLine(int fd) { return std::string(line.get(), line.length); } +StatusOr<std::string> SockReadLineWithRetry(int fd, int retry_times, int retry_interval_ms) { + if (retry_times <= 0 || retry_interval_ms <= 0) { + return SockReadLine(fd); + } + + UniqueEvbuf evbuf; + while (retry_times-- > 0) { + int ret = evbuffer_read(evbuf.get(), fd, -1); + if (ret > 0) { + break; + } + + if (ret == 0) { + return Status::FromErrno("read response err: connection closed"); Review Comment: ```suggestion return {Status::NotOK, "read response err: connection closed"}; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@kvrocks.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org