From 8239f564f772914b2e3ccf3680773cb549fa5242 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 14 Dec 2017 17:55:57 +0900 Subject: [PATCH] ing --- main.go | 6 +++--- main_unix.go | 3 --- main_windows.go | 3 --- server/server.go | 4 ++-- server/server_handlers.go | 4 ++-- 5 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 main_unix.go delete mode 100644 main_windows.go diff --git a/main.go b/main.go index 5d221a0..371c608 100644 --- a/main.go +++ b/main.go @@ -13,11 +13,11 @@ import ( ) var ( - sockFile *string + pidPath *string ) func init() { - sockFile = flag.String("sock", serverAddr, "Socket file") + pidPath = flag.String("pid-path", "/tmp/discovery-container.pid", "The path of pid file") flag.Parse() } @@ -25,7 +25,7 @@ func init() { func main() { defer logging.Logger().Sync() - s := server.New(*sockFile) + s := server.New(*pidPath) stop := make(chan os.Signal) signal.Notify(stop, syscall.SIGINT) diff --git a/main_unix.go b/main_unix.go deleted file mode 100644 index 0bcdf6a..0000000 --- a/main_unix.go +++ /dev/null @@ -1,3 +0,0 @@ -package main - -var serverAddr string = "/tmp/discovery.sock" diff --git a/main_windows.go b/main_windows.go deleted file mode 100644 index d6c6339..0000000 --- a/main_windows.go +++ /dev/null @@ -1,3 +0,0 @@ -package main - -var serverAddr string = "discovery" diff --git a/server/server.go b/server/server.go index feeecad..d93c049 100644 --- a/server/server.go +++ b/server/server.go @@ -7,14 +7,14 @@ import ( oopcs "git.loafle.net/overflow/overflow_probe_container/server" ) -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 diff --git a/server/server_handlers.go b/server/server_handlers.go index b1ae753..29f657f 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -6,9 +6,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 }