OnConnection changed to OnConnect
This commit is contained in:
parent
14b0aea1ca
commit
6dfa8d22e3
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user