Reduce spurious error messages in test suite.

Prevent the possibility of closing the server socket
before calling net/accept-loop in net/server by adding
a call to (ev/sleep 0).
This commit is contained in:
Calvin Rose
2026-09-12 14:11:05 -05:00
parent 716d9f7b5b
commit c8c8afedd2
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -4309,8 +4309,12 @@
(assert (not (and (= cntype :datagram) handler))
"handler not supported for :datagram servers")
(def s (net/listen host port cntype no-reuse))
(if handler
(ev/go (fn :net/server-handler [] (net/accept-loop s handler))))
(when handler
(ev/go (fn :net/server-handler [] (net/accept-loop s handler)))
# Ensure accept-loop has started before returning. Not completely needed, but avoids
# the possibility of closing `s` before `net/accept-loop` runs
# and getting an annoying error print from `:net/server-handler`
(ev/sleep 0))
s))
###
+1 -1
View File
@@ -489,7 +489,7 @@
(defn level-trigger-handling [conn &] (:close conn))
(def s (assert (net/server test-host test-port level-trigger-handling)))
(def c (assert (net/connect test-host test-port)))
(:close s)
(:close s) # closing s before net/server's accept loop starts.
# Issue #1531 no. 2
(def c (ev/chan 0))