2017-11-15 06:59:43 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"os"
|
2017-11-29 05:19:36 +00:00
|
|
|
|
|
|
|
"git.loafle.net/commons_go/server"
|
2017-11-15 06:59:43 +00:00
|
|
|
)
|
|
|
|
|
2017-11-29 05:19:36 +00:00
|
|
|
func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) {
|
2017-11-15 06:59:43 +00:00
|
|
|
os.Remove(sh.addr)
|
|
|
|
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: sh.addr, Net: "unix"})
|
|
|
|
if nil == err {
|
|
|
|
os.Chmod(sh.addr, 0777)
|
|
|
|
}
|
|
|
|
return l, err
|
|
|
|
}
|