server/ipc/ipc_unix.go

19 lines
334 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)
2017-10-26 14:54:25 +00:00
os.Remove(sh.path); nil != err {
2017-10-26 12:30:55 +00:00
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)
}