mirror of
https://github.com/janet-lang/janet
synced 2024-11-25 01:37:19 +00:00
On suite0009 errors for localname/peername, add info
Tag when the issue in the server or in the client. On windows, sometimes these seemed to get swapped for strange reason.
This commit is contained in:
parent
56b4e0b0ec
commit
b5720f6f10
@ -164,7 +164,7 @@
|
|||||||
|
|
||||||
(:close s))
|
(:close s))
|
||||||
|
|
||||||
(defn check-matching-names [stream]
|
(defn check-matching-names [stream tag]
|
||||||
(def ln (net/localname stream))
|
(def ln (net/localname stream))
|
||||||
(def pn (net/peername stream))
|
(def pn (net/peername stream))
|
||||||
(def [my-ip my-port] ln)
|
(def [my-ip my-port] ln)
|
||||||
@ -179,21 +179,20 @@
|
|||||||
(= (string my-port) (get comparison 3))
|
(= (string my-port) (get comparison 3))
|
||||||
(= remote-ip (get comparison 0))
|
(= remote-ip (get comparison 0))
|
||||||
(= (string remote-port) (get comparison 1)))
|
(= (string remote-port) (get comparison 1)))
|
||||||
(string/format "localname should match peername: msg=%j, buf=%j" msg buf)))
|
(string/format "%s: localname should match peername: msg=%j, buf=%j" tag msg buf)))
|
||||||
|
|
||||||
# Test on both server and client
|
# Test on both server and client
|
||||||
(defn names-handler
|
(defn names-handler
|
||||||
[stream]
|
[stream]
|
||||||
(defer (:close stream)
|
(defer (:close stream)
|
||||||
(check-matching-names stream)))
|
(check-matching-names stream "server")))
|
||||||
|
|
||||||
# Test localname and peername
|
# Test localname and peername
|
||||||
(repeat 20
|
(repeat 10
|
||||||
(with [s (net/server "127.0.0.1" "8000" names-handler)]
|
(with [s (net/server "127.0.0.1" "8000" names-handler)]
|
||||||
(defn test-names []
|
(repeat 10
|
||||||
(with [conn (net/connect "127.0.0.1" "8000")]
|
(with [conn (net/connect "127.0.0.1" "8000")]
|
||||||
(check-matching-names conn)))
|
(check-matching-names conn "client"))))
|
||||||
(repeat 20 (test-names)))
|
|
||||||
(gccollect))
|
(gccollect))
|
||||||
|
|
||||||
# Create pipe
|
# Create pipe
|
||||||
|
Loading…
Reference in New Issue
Block a user