MCPcopy
hub / github.com/valyala/fasthttp / acquireCtx

Method acquireCtx

server.go:2918–2936  ·  view source on GitHub ↗
(c net.Conn)

Source from the content-addressed store, hash-verified

2916}
2917
2918func (s *Server) acquireCtx(c net.Conn) (ctx *RequestCtx) {
2919 v := s.ctxPool.Get()
2920 if v == nil {
2921 keepBodyBuffer := !s.ReduceMemoryUsage
2922
2923 ctx = new(RequestCtx)
2924 ctx.Request.keepBodyBuffer = keepBodyBuffer
2925 ctx.Response.keepBodyBuffer = keepBodyBuffer
2926 ctx.s = s
2927 } else {
2928 ctx = v.(*RequestCtx)
2929 }
2930 if s.FormValueFunc != nil {
2931 ctx.formValueFunc = s.FormValueFunc
2932 }
2933 ctx.c = c
2934
2935 return ctx
2936}
2937
2938// Init2 prepares ctx for passing to RequestHandler.
2939//

Callers 2

serveConnCountedMethod · 0.95
acquireByteReaderFunction · 0.80

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected