store: Add missing buffer flushes.

This could result in deadlock in unusual situations, whereby we'd start
waiting for a reply while the query hasn't been flushed to the socket.

* guix/store.scm (buffering-output-port)[flush]: Add call to
'force-output'.
(add-to-store): Add call to 'write-buffered-output'.
This commit is contained in:
Ludovic Courtès 2018-09-17 22:00:26 +02:00
parent d68aa41573
commit 3809824199
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 2 additions and 0 deletions

View File

@ -770,6 +770,7 @@ bytevector) as its internal buffer, and a thunk to flush this output port."
(define (flush)
(put-bytevector port buffer 0 total)
(force-output port)
(set! total 0))
(define (write bv offset count)
@ -927,6 +928,7 @@ path."
(write-int (if recursive? 1 0) port)
(write-string hash-algo port)
(write-file file-name port #:select? select?)
(write-buffered-output server)
(let loop ((done? (process-stderr server)))
(or done? (loop (process-stderr server))))
(read-store-path port)))))