This commit is contained in:
crusader 2017-12-14 17:51:08 +09:00
parent f8580434e8
commit f4a6b873f1
6 changed files with 7 additions and 15 deletions

View File

@ -1,6 +1,5 @@
package sqlserver
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/sqlserver"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"

View File

@ -13,19 +13,18 @@ import (
)
var (
sockFile *string
pidPath *string
)
func init() {
sockFile = flag.String("sock", serverAddr, "Socket file")
pidPath = flag.String("pid-path", "/tmp/network-container.pid", "The path of pid file")
flag.Parse()
}
func main() {
defer logging.Logger().Sync()
s := server.New(*sockFile)
s := server.New(*pidPath)
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGINT)

View File

@ -1,3 +0,0 @@
package main
var serverAddr string = "/tmp/container_network.sock"

View File

@ -1,3 +0,0 @@
package main
var serverAddr string = "container_network"

View File

@ -7,14 +7,14 @@ import (
"git.loafle.net/overflow/overflow_probe_container_network/service"
)
func New(addr string) server.Server {
func New(pidPath string) server.Server {
rpcRegistry := crr.NewRPCRegistry()
service.RegisterRPC(rpcRegistry)
rpcSH := oopcs.NewRPCServletHandler(rpcRegistry)
socketHandler := newSocketHandler(rpcSH)
sh := newServerHandler(addr, socketHandler)
sh := newServerHandler(pidPath, socketHandler)
s := oopcs.New(sh)
return s

View File

@ -5,9 +5,9 @@ import (
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
)
func newServerHandler(addr string, socketHandler SocketHandler) ServerHandler {
func newServerHandler(pidPath string, socketHandler SocketHandler) ServerHandler {
sh := &ServerHandlers{}
sh.ServerHandler = oopcs.NewServerHandler(addr, "Discovery Containter", socketHandler)
sh.ServerHandler = oopcs.NewServerHandler(pidPath, "Discovery Containter", socketHandler)
return sh
}