mirror of
https://github.com/pgsty/minio.git
synced 2026-10-16 14:45:59 +03:00
fix: keep scanner response resets local and strengthen regression tests
Keep the legacy header resets and clear the unused NSScanner response field at each construction site. Remove the generic stream Recycler call: Recycler transfers resource ownership and cannot be treated as a reset hook followed by another insertion into the handler's pool. Exercise the actual NSScanner handler across repeated scans with dirty response allocations, so the regression test does not depend on sync.Pool reusing an object. Check both response variants after wire serialization. Cover legacy DecodeMsg and reused indexed metadata headers as well. Retain the original contributor's commits and DCO sign-offs. Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -698,11 +698,6 @@ func (h *StreamTypeHandler[Payload, Req, Resp]) PutRequest(r Req) {
|
||||
// These should be returned by the caller.
|
||||
func (h *StreamTypeHandler[Payload, Req, Resp]) PutResponse(r Resp) {
|
||||
if r != h.nilResp {
|
||||
if rc, ok := any(r).(Recycler); ok {
|
||||
// Recycled stream responses must not leak fields
|
||||
// from a previous use into the next response.
|
||||
rc.Recycle()
|
||||
}
|
||||
//nolint:staticcheck // SA6002 IT IS A GENERIC VALUE! (and always a pointer)
|
||||
h.respPool.Put(r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user