summaryrefslogtreecommitdiff
path: root/guix/scripts/substitute.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-05-20 10:42:56 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-06-01 09:10:32 +0200
commit0b8fa24bbd3576a8b20f27930e9a6b296e6b6068 (patch)
tree6a5f3d978fd6f4fa957912695e724e5d044d5219 /guix/scripts/substitute.scm
parent2acc114a963e91852ce517e763272528e4ba99a0 (diff)
publish: Add keep-alive support when sending nar.
The default Guile web server implementation supports the keep alive mechanism. However, in our custom http-write implementation, the connection is unconditionally close after sending nar files. To prevent that, when supported, add the client port to the server poll set so that further requests can be handled without closing the connection. * guix/scripts/publish.scm (nar-response-port): Rename it into ... (nar-compressed-port): ... this procedure. Operate directly on a given PORT. (http-write): Add keep-alive support when sending nar files. * guix/scripts/substitute.scm (process-substitution): Pass the download size to the progress-report-port procedure so that it doesn't block reading from the input port when keep-alive is supported.
Diffstat (limited to 'guix/scripts/substitute.scm')
-rwxr-xr-xguix/scripts/substitute.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 8e4eae00b3..54311c3e08 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -518,8 +518,11 @@ PORT."
(current-error-port)
#:abbreviation nar-uri-abbreviation))))
;; Keep RAW open upon completion so we can later reuse
- ;; the underlying connection.
- (progress-report-port reporter raw #:close? #f)))
+ ;; the underlying connection. Pass the download size so
+ ;; that this procedure won't block reading from RAW.
+ (progress-report-port reporter raw
+ #:close? #f
+ #:download-size dl-size)))
((input pids)
;; NOTE: This 'progress' port of current process will be
;; closed here, while the child process doing the