Close socket

This commit is contained in:
Michiel Borkent 2019-12-17 12:23:34 +01:00
parent c2d9bbfab2
commit aa8e6b160b

View file

@ -17,8 +17,8 @@
opts) opts)
t0 (System/currentTimeMillis)] t0 (System/currentTimeMillis)]
(loop [] (loop []
(let [v (try (Socket. host port) (let [v (try (with-open [_ (Socket. host port)]
(- (System/currentTimeMillis) t0) (- (System/currentTimeMillis) t0))
(catch ConnectException _e (catch ConnectException _e
(let [took (- (System/currentTimeMillis) t0)] (let [took (- (System/currentTimeMillis) t0)]
(if (and timeout (>= took timeout)) (if (and timeout (>= took timeout))