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
|
|
|
|
2017-11-15 04:13:47 +00:00
|
|
|
// OnStop invoked when server is stopped
|
|
|
|
// If you override ths method, must call
|
|
|
|
//
|
|
|
|
// func (sh *ServerHandler) OnStop() {
|
|
|
|
// ...
|
|
|
|
// sh.ServerHandler.OnStop()
|
|
|
|
// }
|
2017-11-29 00:51:41 +00:00
|
|
|
OnStop(serverCTX ServerContext)
|
2017-10-27 05:27:36 +00:00
|
|
|
|
2017-11-15 04:13:47 +00:00
|
|
|
GetName() string
|
2017-10-26 11:14:00 +00:00
|
|
|
|
|
|
|
Validate()
|
|
|
|
}
|