server-go/net/servlet.go
crusader 899fc53ded ing
2018-04-05 01:51:34 +09:00

46 lines
896 B
Go

package net
import (
"net"
"git.loafle.net/commons/server-go"
)
type Servlet interface {
server.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) 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 server.Conn) {
//
}
func (s *Servlets) Handle(servletCtx server.ServletCtx, stopChan <-chan struct{}, doneChan chan<- struct{}, readChan <-chan []byte, writeChan chan<- []byte) {
}
func (s *Servlets) OnDisconnect(servletCtx server.ServletCtx) {
//
}