summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-04-18 00:28:39 +0200
committerLudovic Courtès <ludo@gnu.org>2017-04-18 23:17:18 +0200
commit339a79fd6aec74f0b7520440e01b8bf79eca73e7 (patch)
tree819eb5247548c476e762c40a88725a700de0ae64
parent905ae5276d22b600079eaaa2032fbf5bd435331e (diff)
downloadguix-339a79fd6aec74f0b7520440e01b8bf79eca73e7.tar.gz
publish: Use 'sendfile' when possible.
* guix/scripts/publish.scm (http-write): In the
'application/octet-stream' case, use 'sendfile' when OUTPUT is a file
port.
-rw-r--r--guix/scripts/publish.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index 111cb29bca..f54757b4c9 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -469,7 +469,9 @@ blocking."
                                                                       size)
                                                  client))
                        (output   (response-port response)))
-                  (dump-port input output)
+                  (if (file-port? output)
+                      (sendfile output input size)
+                      (dump-port input output))
                   (close-port output)
                   (values)))))
           (lambda args