>From 020cdb7f7915876ff808b37430846a26dfab702b Mon Sep 17 00:00:00 2001 From: Alexey Abramov Date: Mon, 3 May 2021 16:53:04 +0200 Subject: [PATCH] agenda: Honor closed ports * 8sync/agenda.scm (update-agenda-from-select!)[ports-to-select?]: Cleanup ports which have been closed, before monitoring them with select. --- 8sync/agenda.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/8sync/agenda.scm b/8sync/agenda.scm index e91487e..6b851a8 100644 --- a/8sync/agenda.scm +++ b/8sync/agenda.scm @@ -514,6 +514,13 @@ Also handles sleeping when all we have to do is wait on the schedule." (not (= (hash-count (const #t) (selector agenda)) 0))) + (define (drop-closed-ports! table) + (for-each (lambda (port) + (when (port-closed? port) + (hash-remove! table port))) + (hash-keys table))) + (drop-closed-ports! (agenda-write-port-map agenda)) + (drop-closed-ports! (agenda-read-port-map agenda)) (or (has-items? agenda-read-port-map) (has-items? agenda-write-port-map))) -- 2.31.1