GNU bug report logs -
#48558
[PATCH 3/4] progress: Add a download-size argument to progress-report-port.
Previous Next
Reported by: Mathieu Othacehe <othacehe <at> gnu.org>
Date: Fri, 21 May 2021 08:28:03 UTC
Severity: normal
Tags: patch
Done: Mathieu Othacehe <mathieu <at> meije.i-did-not-set--mail-host-address--so-tickle-me>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48558 in the body.
You can then email your comments to 48558 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#48558
; Package
guix-patches
.
(Fri, 21 May 2021 08:28:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mathieu Othacehe <othacehe <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Fri, 21 May 2021 08:28:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* guix/progress.scm (progress-report-port): Add a download-size argument.
---
guix/progress.scm | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/guix/progress.scm b/guix/progress.scm
index 334bd40547..0cbc804ec1 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -347,15 +347,25 @@ should be a <progress-reporter> object."
(report total)
(loop total (get-bytevector-n! in buffer 0 buffer-size))))))))
-(define* (progress-report-port reporter port #:key (close? #t))
+(define* (progress-report-port reporter port
+ #:key
+ (close? #t)
+ download-size)
"Return a port that continuously reports the bytes read from PORT using
REPORTER, which should be a <progress-reporter> object. When CLOSE? is true,
-PORT is closed when the returned port is closed."
+PORT is closed when the returned port is closed.
+
+When DOWNLOAD-SIZE is passed, do not read more than DOWNLOAD-SIZE bytes from
+PORT. This is important to avoid blocking when the remote side won't close
+the underlying connection."
(match reporter
(($ <progress-reporter> start report stop)
(let* ((total 0)
(read! (lambda (bv start count)
- (let ((n (match (get-bytevector-n! port bv start count)
+ (let* ((count (if download-size
+ (min count (- download-size total))
+ count))
+ (n (match (get-bytevector-n! port bv start count)
((? eof-object?) 0)
(x x))))
(set! total (+ total n))
--
2.31.1
bug closed, send any further explanations to
48558 <at> debbugs.gnu.org and Mathieu Othacehe <othacehe <at> gnu.org>
Request was from
Mathieu Othacehe <mathieu <at> meije.i-did-not-set--mail-host-address--so-tickle-me>
to
control <at> debbugs.gnu.org
.
(Fri, 21 May 2021 08:55:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 18 Jun 2021 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 17 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.