56 lines
947 B
Go
56 lines
947 B
Go
|
package server
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
|
||
|
"git.loafle.net/commons_go/server"
|
||
|
)
|
||
|
|
||
|
func newSocketHandler(rpcSH RPCServletHandler) SocketHandler {
|
||
|
sh := &SocketHandlers{
|
||
|
rpcSH: rpcSH,
|
||
|
}
|
||
|
|
||
|
return sh
|
||
|
}
|
||
|
|
||
|
type SocketHandlers struct {
|
||
|
server.SocketHandlers
|
||
|
|
||
|
rpcSH RPCServletHandler
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) Init(serverCTX server.ServerContext) error {
|
||
|
if err := sh.SocketHandlers.Init(serverCTX); nil != err {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) Handshake(serverCTX server.ServerContext, conn net.Conn) (id string) {
|
||
|
return ""
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) OnConnect(soc server.Socket) {
|
||
|
// no op
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) Handle(soc server.Socket, stopChan <-chan struct{}, doneChan chan<- error) {
|
||
|
// no op
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) OnDisconnect(soc server.Socket) {
|
||
|
|
||
|
sh.SocketHandlers.OnDisconnect(soc)
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) Destroy() {
|
||
|
|
||
|
sh.SocketHandlers.Destroy()
|
||
|
}
|
||
|
|
||
|
func (sh *SocketHandlers) Validate() {
|
||
|
|
||
|
}
|