52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package server
|
|
|
|
import (
|
|
"net"
|
|
|
|
"git.loafle.net/commons_go/server"
|
|
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
|
|
oopcService "git.loafle.net/overflow/overflow_probe_container/service"
|
|
)
|
|
|
|
func newSocketHandler(rpcSH oopcs.RPCServletHandler, probeService *oopcService.ProbeService) SocketHandler {
|
|
sh := &SocketHandlers{}
|
|
sh.SocketHandler = oopcs.NewSocketHandler(rpcSH, probeService)
|
|
|
|
return sh
|
|
}
|
|
|
|
type SocketHandlers struct {
|
|
oopcs.SocketHandler
|
|
}
|
|
|
|
func (sh *SocketHandlers) Init(serverCTX server.ServerContext) error {
|
|
if err := sh.SocketHandler.Init(serverCTX); nil != err {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (sh *SocketHandlers) Handshake(socketCTX server.SocketContext, conn net.Conn) (id string) {
|
|
return "DiscoveryContainer"
|
|
}
|
|
|
|
func (sh *SocketHandlers) OnConnect(soc server.Socket) {
|
|
sh.SocketHandler.OnConnect(soc)
|
|
|
|
}
|
|
|
|
func (sh *SocketHandlers) OnDisconnect(soc server.Socket) {
|
|
|
|
sh.SocketHandler.OnDisconnect(soc)
|
|
}
|
|
|
|
func (sh *SocketHandlers) Destroy() {
|
|
|
|
sh.SocketHandler.Destroy()
|
|
}
|
|
|
|
func (sh *SocketHandlers) Validate() {
|
|
sh.SocketHandler.Validate()
|
|
}
|