OnConnection changed to OnConnect

This commit is contained in:
crusader 2017-09-20 14:25:52 +09:00
parent 14b0aea1ca
commit 6dfa8d22e3
3 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ func (s *server) onDisconnected(soc Socket) {
s._sh.OnDisconnected(soc)
}
func (s *server) onConnection(ctx *fasthttp.RequestCtx) {
func (s *server) onConnect(ctx *fasthttp.RequestCtx) {
path := string(ctx.Path())
co, ok := s._handlers[path]
if !ok {
@ -89,7 +89,7 @@ func (s *server) onConnection(ctx *fasthttp.RequestCtx) {
return
}
if !s._sh.OnConnection(ctx) {
if !s._sh.OnConnect(ctx) {
ctx.Error(http.StatusText(http.StatusNotAcceptable), http.StatusNotAcceptable)
return
}
@ -140,5 +140,5 @@ func (s *server) HandleSocket(pattern string, soch SocketHandler) {
func (s *server) ListenAndServe(addr string) error {
go s.listenHandler()
return fasthttp.ListenAndServe(addr, s.onConnection)
return fasthttp.ListenAndServe(addr, s.onConnect)
}

View File

@ -12,7 +12,7 @@ type ServerHandler interface {
GetWriteBufferSize() int
GetEnableCompression() bool
OnConnection(ctx *fasthttp.RequestCtx) bool
OnConnect(ctx *fasthttp.RequestCtx) bool
OnConnected(soc Socket)
OnDisconnected(soc Socket)
OnCheckOrigin(ctx *fasthttp.RequestCtx) bool

View File

@ -42,7 +42,7 @@ func (sh *ServerHandlers) GetEnableCompression() bool {
return sh.EnableCompression
}
func (sh *ServerHandlers) OnConnection(ctx *fasthttp.RequestCtx) bool {
func (sh *ServerHandlers) OnConnect(ctx *fasthttp.RequestCtx) bool {
return true
}