mirror of
https://github.com/janet-lang/janet
synced 2026-09-22 08:58:42 +00:00
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:
+6
-2
@@ -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
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user