[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Thu, 29 Jun 2023 16:10:50 -0400 (EDT) |
branch: master
commit ec44dba635a711a795c3e32d6d9efbee2c3d8aad
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Jun 29 11:47:51 2023 +0200
remote-server: Correctly check the result of 'zmq-poll'.
This partially reverts bb7579acc0a1c6dc1c8f5b994593e5b19b3f8e83, which
introduced an incorrect membership test with 'memq'.
* src/cuirass/scripts/remote-server.scm (zmq-start-proxy)[socket-ready?]:
New procedure.
Use it when checking the result of 'zmq-poll*'.
---
src/cuirass/scripts/remote-server.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/cuirass/scripts/remote-server.scm
b/src/cuirass/scripts/remote-server.scm
index 38bac73..accbc4c 100644
--- a/src/cuirass/scripts/remote-server.scm
+++ b/src/cuirass/scripts/remote-server.scm
@@ -455,6 +455,11 @@ all network interfaces."
(define (zmq-start-proxy backend-port)
"This procedure starts a proxy between client connections from the IPC
frontend to the workers connected through the TCP backend."
+ (define (socket-ready? items socket)
+ (find (lambda (item)
+ (eq? (poll-item-socket item) socket))
+ items))
+
;; The poll loop below must not be blocked. Print a warning message if a
;; loop iteration takes more than %LOOP-TIMEOUT seconds to complete.
(define %loop-timeout 5)
@@ -478,7 +483,7 @@ frontend to the workers connected through the TCP backend."
(let loop ()
(let* ((items (zmq-poll* poll-items 1000))
(start-time (current-time)))
- (when (memq build-socket items)
+ (when (socket-ready? items build-socket)
(match (zmq-message-receive* build-socket)
((worker empty rest)
(let* ((command (bv->string (zmq-message-content rest)))