Verified Commit 848616b1 authored by Jakob Moser's avatar Jakob Moser
Browse files

Unlink socket before starting the server

parent b21b5c33
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ class Server:
                handler(data)

    def __post_init__(self) -> None:
        # Delete the socket path, if it still exist, because it is then most likely a remnant of some untidly
        # terminated run of the application. We could of course also just have crashed a still running run of
        # the application (if we started the server on the same socket twice), but this is very unlikely.
        self.socket_path.unlink(missing_ok=True)
        self._server = ThreadingUnixStreamServer(
            str(self.socket_path.resolve()),
            Server.RequestHandler,