This commit is contained in:
Michiel Borkent 2020-10-21 17:28:11 +02:00
parent 02cef05574
commit a0418d6622

View file

@ -244,7 +244,7 @@
(Socket. hostname port)) (Socket. hostname port))
(defn close-socket (defn close-socket
"Close the socket, and also closes its input and output streams. Returns nil." "Close the socket, and also closes its input and output streams."
[^Socket socket] [^Socket socket]
(try (.close socket) (try (.close socket)
nil nil
@ -318,9 +318,11 @@
(get-string ns "name")) (get-string ns "name"))
(next-id)) (next-id))
_ (add-shutdown-hook! #(do _ (add-shutdown-hook! #(do
(destroy pod-id)
(when socket (when socket
(close-socket socket)) ;; this probably isn't necessary because we
(destroy pod-id))) ;; killed the process, but anyway
(close-socket socket))))
pod (assoc pod :pod-id pod-id) pod (assoc pod :pod-id pod-id)
pod-namespaces (mapv #(bencode->namespace pod %) pod-namespaces (mapv #(bencode->namespace pod %)
pod-namespaces) pod-namespaces)