server/server_handler.go

31 lines
615 B
Go
Raw Normal View History

2017-10-26 11:14:00 +00:00
package server
import (
"net"
)
type ServerHandler interface {
2017-11-29 00:51:41 +00:00
ServerContext() ServerContext
Init(serverCTX ServerContext) error
Listen(serverCTX ServerContext) (net.Listener, error)
OnStart(serverCTX ServerContext)
2017-11-01 05:22:52 +00:00
2017-11-29 00:51:41 +00:00
OnError(serverCTX ServerContext, conn net.Conn, status int, reason error)
2017-10-27 08:53:26 +00:00
2018-03-27 06:43:21 +00:00
OnStop(serverCTX ServerContext)
// Destroy invoked when server will destroy
2017-11-15 04:13:47 +00:00
// If you override ths method, must call
//
2018-03-27 06:43:21 +00:00
// func (sh *ServerHandler) Destroy() {
2017-11-15 04:13:47 +00:00
// ...
2018-03-27 06:43:21 +00:00
// sh.ServerHandler.Destroy()
2017-11-15 04:13:47 +00:00
// }
2018-03-27 06:43:21 +00:00
Destroy(serverCTX ServerContext)
2017-10-27 05:27:36 +00:00
2017-11-15 04:13:47 +00:00
GetName() string
2017-11-29 03:46:40 +00:00
GetSocketHandler() SocketHandler
2017-10-26 11:14:00 +00:00
Validate()
}