server/ipc/ipc_unix.go

21 lines
365 B
Go
Raw Normal View History

2017-10-26 12:30:55 +00:00
package ipc
import (
"net"
"os"
"path/filepath"
)
func (sh *ServerHandlers) Listen() (net.Listener, error) {
sh.path = filepath.Join(os.TempDir(), sh.Addr)
if err := os.Remove(sh.path); nil != err {
return nil, err
}
return net.ListenUnix("unix", &net.UnixAddr{Name: sh.path, Net: "unix"})
}
2017-10-26 12:34:15 +00:00
func (sh *ServerHandlers) Stopped() {
os.Remove(sh.path)
}