From 8f9b2ba00d704a4de1a0750960abad6b0ded0011 Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Sat, 23 Jun 2018 17:50:57 +0300 Subject: clean up unix sockets --- service/rpc/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service/rpc/config.go b/service/rpc/config.go index 06d63d65..e3168945 100644 --- a/service/rpc/config.go +++ b/service/rpc/config.go @@ -4,6 +4,7 @@ import ( "errors" "net" "strings" + "syscall" ) type config struct { @@ -21,6 +22,10 @@ func (cfg *config) listener() (net.Listener, error) { return nil, errors.New("invalid socket DSN (tcp://:6001, unix://rpc.sock)") } + if dsn[0] == "unix" { + syscall.Unlink(dsn[1]) + } + return net.Listen(dsn[0], dsn[1]) } -- cgit v1.2.3