ing
This commit is contained in:
parent
1dbb36ba57
commit
8239f564f7
6
main.go
6
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)
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
package main
|
||||
|
||||
var serverAddr string = "/tmp/discovery.sock"
|
|
@ -1,3 +0,0 @@
|
|||
package main
|
||||
|
||||
var serverAddr string = "discovery"
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user