2017-11-29 05:19:36 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"git.loafle.net/commons_go/server"
|
2017-12-05 05:58:32 +00:00
|
|
|
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
|
2018-03-22 16:11:03 +00:00
|
|
|
oopcService "git.loafle.net/overflow/overflow_probe_container/service"
|
2017-11-29 05:19:36 +00:00
|
|
|
)
|
|
|
|
|
2018-03-22 16:11:03 +00:00
|
|
|
func newSocketHandler(rpcSH oopcs.RPCServletHandler, probeService *oopcService.ProbeService) SocketHandler {
|
2017-12-05 05:58:32 +00:00
|
|
|
sh := &SocketHandlers{}
|
2018-03-22 16:11:03 +00:00
|
|
|
sh.SocketHandler = oopcs.NewSocketHandler(rpcSH, probeService)
|
2017-11-29 05:19:36 +00:00
|
|
|
|
|
|
|
return sh
|
|
|
|
}
|
|
|
|
|
|
|
|
type SocketHandlers struct {
|
2017-12-05 05:58:32 +00:00
|
|
|
oopcs.SocketHandler
|
2017-11-29 05:19:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *SocketHandlers) Init(serverCTX server.ServerContext) error {
|
2017-12-05 05:58:32 +00:00
|
|
|
if err := sh.SocketHandler.Init(serverCTX); nil != err {
|
2017-11-29 05:19:36 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-12-01 08:29:54 +00:00
|
|
|
func (sh *SocketHandlers) Handshake(socketCTX server.SocketContext, conn net.Conn) (id string) {
|
2017-12-05 06:10:16 +00:00
|
|
|
return "DiscoveryContainer"
|
2017-11-29 05:19:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *SocketHandlers) OnConnect(soc server.Socket) {
|
2017-12-05 05:58:32 +00:00
|
|
|
sh.SocketHandler.OnConnect(soc)
|
2017-11-29 05:46:47 +00:00
|
|
|
|
2017-11-29 05:19:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *SocketHandlers) OnDisconnect(soc server.Socket) {
|
|
|
|
|
2017-12-05 05:58:32 +00:00
|
|
|
sh.SocketHandler.OnDisconnect(soc)
|
2017-11-29 05:19:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *SocketHandlers) Destroy() {
|
|
|
|
|
2017-12-05 05:58:32 +00:00
|
|
|
sh.SocketHandler.Destroy()
|
2017-11-29 05:19:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *SocketHandlers) Validate() {
|
2017-12-05 06:10:16 +00:00
|
|
|
sh.SocketHandler.Validate()
|
2017-11-29 05:19:36 +00:00
|
|
|
}
|