~ruther/guix-local

e36a71721630a827a094ad07f250eada16d1f674 — Ludovic Courtès 13 years ago 561eaf7
Upgrade Nix worker protocol.

We were already relying on the new version in `set-build-options', so
this patch fixes that.

* guix/store.scm (%protocol-version): Increase.
  (open-connection)[reserve-space?]: New argument.  Pass it to the
  server when it's recent enough.
1 files changed, 5 insertions(+), 2 deletions(-)

M guix/store.scm
M guix/store.scm => guix/store.scm +5 -2
@@ 53,7 53,7 @@
            store-path?
            derivation-path?))

(define %protocol-version #x109)
(define %protocol-version #x10b)

(define %worker-magic-1 #x6e697863)
(define %worker-magic-2 #x6478696f)


@@ 257,7 257,8 @@
  (message nix-protocol-error-message)
  (status  nix-protocol-error-status))

(define* (open-connection #:optional (file %default-socket-path))
(define* (open-connection #:optional (file %default-socket-path)
                          #:key (reserve-space? #t))
  (let ((s (with-fluids ((%default-port-encoding #f))
             ;; This trick allows use of the `scm_c_read' optimization.
             (socket PF_UNIX SOCK_STREAM 0)))


@@ 271,6 272,8 @@
                        (protocol-major v))
                  (begin
                    (write-int %protocol-version s)
                    (if (>= (protocol-minor v) 11)
                        (write-int (if reserve-space? 1 0) s))
                    (let ((s (%make-nix-server s
                                               (protocol-major v)
                                               (protocol-minor v))))