Handle socket exception gracefully.
This commit is contained in:
parent
df334946b9
commit
02cef05574
1 changed files with 4 additions and 2 deletions
|
|
@ -244,9 +244,11 @@
|
||||||
(Socket. hostname port))
|
(Socket. hostname port))
|
||||||
|
|
||||||
(defn close-socket
|
(defn close-socket
|
||||||
"Close the socket, and also closes its input and output streams."
|
"Close the socket, and also closes its input and output streams. Returns nil."
|
||||||
[^Socket socket]
|
[^Socket socket]
|
||||||
(.close socket))
|
(try (.close socket)
|
||||||
|
nil
|
||||||
|
(catch java.net.SocketException _ nil)))
|
||||||
|
|
||||||
(defn port-file [pid]
|
(defn port-file [pid]
|
||||||
(io/file (str ".babashka-pod-" pid ".port")))
|
(io/file (str ".babashka-pod-" pid ".port")))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue