server-go/socket/net/servlet.go
crusader d1d485c711 ing
2018-06-29 19:02:40 +09:00

55 lines
1.1 KiB
Go

package net
import (
"net"
"git.loafle.net/commons/server-go"
"git.loafle.net/commons/server-go/socket"
)
type Servlet interface {
socket.Servlet
Handshake(servletCtx server.ServletCtx, conn net.Conn) error
}
type Servlets struct {
Servlet
}
func (s *Servlets) ServletCtx(serverCtx server.ServerCtx) server.ServletCtx {
return server.NewServletContext(nil, serverCtx)
}
func (s *Servlets) Init(serverCtx server.ServerCtx) error {
return nil
}
func (s *Servlets) OnStart(serverCtx server.ServerCtx) error {
return nil
}
func (s *Servlets) OnStop(serverCtx server.ServerCtx) {
//
}
func (s *Servlets) Destroy(serverCtx server.ServerCtx) {
//
}
func (s *Servlets) Handshake(servletCtx server.ServletCtx, conn net.Conn) error {
return nil
}
func (s *Servlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
//
}
func (s *Servlets) Handle(servletCtx server.ServletCtx, stopChan <-chan struct{}, doneChan chan<- struct{}, readChan <-chan socket.SocketMessage, writeChan chan<- socket.SocketMessage) {
}
func (s *Servlets) OnDisconnect(servletCtx server.ServletCtx) {
//
}