45 lines
952 B
Go
45 lines
952 B
Go
package server
|
|
|
|
import (
|
|
"git.loafle.net/commons_go/server"
|
|
"git.loafle.net/overflow/overflow_discovery/discovery"
|
|
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
|
|
)
|
|
|
|
func newServerHandler(addr string, socketHandler SocketHandler) ServerHandler {
|
|
sh := &ServerHandlers{}
|
|
sh.ServerHandler = oopcs.NewServerHandler(addr, "Discovery Containter", socketHandler)
|
|
|
|
return sh
|
|
}
|
|
|
|
type ServerHandlers struct {
|
|
oopcs.ServerHandler
|
|
}
|
|
|
|
func (sh *ServerHandlers) Init(serverCTX server.ServerContext) error {
|
|
if err := sh.ServerHandler.Init(serverCTX); nil != err {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) {
|
|
sh.ServerHandler.OnStart(serverCTX)
|
|
|
|
discovery.DiscoveryInit()
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnStop(serverCTX server.ServerContext) {
|
|
|
|
discovery.DiscoveryDestroy()
|
|
|
|
sh.ServerHandler.OnStop(serverCTX)
|
|
}
|
|
|
|
func (sh *ServerHandlers) Validate() {
|
|
sh.ServerHandler.Validate()
|
|
|
|
}
|