civodul pushed a commit to branch master in repository shepherd. commit e4989cab043005af8e19a06703399f6a67f81eb7 Author: Ludovic Courtès <l...@gnu.org> Date: Wed Jan 27 14:33:43 2016 +0100
comm: Buffer the communication socket on the server side. * modules/shepherd.scm (main): Add 'setvbuf' call. * modules/shepherd/comm.scm (write-reply): Add 'force-output' call. --- modules/shepherd.scm | 1 + modules/shepherd/comm.scm | 5 ++++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/modules/shepherd.scm b/modules/shepherd.scm index d258e7f..e8bd44f 100644 --- a/modules/shepherd.scm +++ b/modules/shepherd.scm @@ -204,6 +204,7 @@ (let next-command () (match (accept sock) ((command-source . client-address) + (setvbuf command-source _IOFBF 1024) (process-connection command-source)) (_ #f)) (next-command)))))) diff --git a/modules/shepherd/comm.scm b/modules/shepherd/comm.scm index 7590171..0228f63 100644 --- a/modules/shepherd/comm.scm +++ b/modules/shepherd/comm.scm @@ -144,7 +144,10 @@ wrong---premature end-of-file, invalid sexp, etc." (result ,(result->sexp result)) (error ,error) (messages ,messages)) - port)))) + port) + + ;; PORT may be buffered so make sure the command goes out. + (force-output port)))) ;; This generic function must be extended to provide sexp representations of ;; results that go in <command-reply> objects.