This commit is contained in:
crusader 2017-12-05 12:29:49 +09:00
parent 7e2813ad35
commit 84a1d91c52
4 changed files with 26 additions and 36 deletions

View File

@ -5,11 +5,7 @@ import (
)
func NewSocketBuilder(address string) csc.SocketBuilder {
sb := &SocketBuilders{}
sb.Network = "tcp"
sb.Address = "localhost:50006"
return sb
return newSocketBuilder(address)
}
type SocketBuilders struct {

View File

@ -2,7 +2,6 @@ package server
import (
"fmt"
"net"
"git.loafle.net/commons_go/logging"
"git.loafle.net/overflow/overflow_discovery/discovery"
@ -34,11 +33,6 @@ func (sh *ServerHandlers) Init(serverCTX server.ServerContext) error {
return nil
}
func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) {
return net.Listen("tcp", "localhost:50006")
}
func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) {
sh.ServerHandlers.OnStart(serverCTX)

View File

@ -1,17 +1,17 @@
package server
// import (
// "net"
// "os"
import (
"net"
"os"
// "git.loafle.net/commons_go/server"
// )
"git.loafle.net/commons_go/server"
)
// func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) {
// 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
// }
func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) {
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
}

View File

@ -1,16 +1,16 @@
package server
// import (
// "net"
import (
"net"
// "git.loafle.net/commons_go/server"
// "gopkg.in/natefinch/npipe.v2"
// )
"git.loafle.net/commons_go/server"
"gopkg.in/natefinch/npipe.v2"
)
// func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) {
// ln, err := npipe.Listen(`\\.\pipe\` + sh.addr)
// if err != nil {
// // handle error
// }
// return ln, err
// }
func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, error) {
ln, err := npipe.Listen(`\\.\pipe\` + sh.addr)
if err != nil {
// handle error
}
return ln, err
}