Skip to content

Commit

Permalink
chore: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
welkeyever committed Nov 11, 2024
1 parent b5f96a1 commit 9b3abb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pkg/protocol/http1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
func init() {
if b, err := utils.GetBoolFromEnv("HERTZ_DISABLE_REQUEST_CONTEXT_POOL"); err == nil {
hlog.Infof("HERTZ_DISABLE_REQUEST_CONTEXT_POOL env is set to %t", b)
disabaleRequestContextPool = b
disableRequestContextPool = b
}
}

Expand All @@ -61,7 +61,7 @@ var (
errShortConnection = errs.New(errs.ErrShortConnection, errs.ErrorTypePublic, "server is going to close the connection")
errUnexpectedEOF = errs.NewPublic(io.ErrUnexpectedEOF.Error() + " when reading request")

disabaleRequestContextPool = false
disableRequestContextPool = false
)

type Option struct {
Expand Down Expand Up @@ -92,14 +92,14 @@ type Server struct {
}

func (s Server) getRequestContext() *app.RequestContext {
if disabaleRequestContextPool {
if disableRequestContextPool {
return &app.RequestContext{}
}
return s.Core.GetCtxPool().Get().(*app.RequestContext)
}

func (s Server) putRequestContext(ctx *app.RequestContext) {
if disabaleRequestContextPool {
if disableRequestContextPool {
return
}
ctx.Reset()
Expand Down
4 changes: 2 additions & 2 deletions pkg/protocol/http1/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ func TestServerDisableReqCtxPool(t *testing.T) {
defaultConn := mock.NewConn("GET / HTTP/1.1\nHost: foobar.com\n\n")
err := server.Serve(context.TODO(), defaultConn)
assert.Nil(t, err)
disabaleRequestContextPool = true
disableRequestContextPool = true
defer func() {
// reset global variable
disabaleRequestContextPool = false
disableRequestContextPool = false
}()
server.Core = &mockCore{
ctxPool: &sync.Pool{New: func() interface{} {
Expand Down

0 comments on commit 9b3abb0

Please sign in to comment.