mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-16 16:17:38 +03:00
Make sure to reset the userValues always and at the exact time (#1027)
* Ensure reset userValues always that release RequestCtx * Reset userValues after response write and hijack handler are executed
This commit is contained in:
committed by
GitHub
parent
a18c6322a2
commit
b433ecfcbd
@@ -2237,8 +2237,6 @@ func (s *Server) serveConn(c net.Conn) (err error) {
|
||||
hijackNoResponse = ctx.hijackNoResponse && hijackHandler != nil
|
||||
ctx.hijackNoResponse = false
|
||||
|
||||
ctx.userValues.Reset()
|
||||
|
||||
if s.MaxRequestsPerConn > 0 && connRequestNum >= uint64(s.MaxRequestsPerConn) {
|
||||
ctx.SetConnectionClose()
|
||||
}
|
||||
@@ -2329,6 +2327,7 @@ func (s *Server) serveConn(c net.Conn) (err error) {
|
||||
}
|
||||
|
||||
s.setState(c, StateIdle)
|
||||
ctx.userValues.Reset()
|
||||
|
||||
if atomic.LoadInt32(&s.stop) == 1 {
|
||||
err = nil
|
||||
@@ -2651,6 +2650,7 @@ func (s *Server) releaseCtx(ctx *RequestCtx) {
|
||||
ctx.c = nil
|
||||
ctx.remoteAddr = nil
|
||||
ctx.fbr.c = nil
|
||||
ctx.userValues.Reset()
|
||||
s.ctxPool.Put(ctx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user