release is a method to reset context fields when to use ReleaseCtx()
()
| 702 | |
| 703 | // release is a method to reset context fields when to use ReleaseCtx() |
| 704 | func (c *DefaultCtx) release() { |
| 705 | if c.isUserContextSet { |
| 706 | if c.fasthttp != nil { |
| 707 | c.fasthttp.SetUserValue(userContextKey, nil) |
| 708 | } |
| 709 | c.isUserContextSet = false |
| 710 | } |
| 711 | c.route = nil |
| 712 | c.fasthttp = nil |
| 713 | if c.bind != nil { |
| 714 | ReleaseBind(c.bind) |
| 715 | c.bind = nil |
| 716 | } |
| 717 | c.flashMessages = c.flashMessages[:0] |
| 718 | // Clear viewBindMap by deleting all keys (reuse underlying map if possible) |
| 719 | if c.viewBindMap != nil { |
| 720 | clear(c.viewBindMap) |
| 721 | } |
| 722 | if c.redirect != nil { |
| 723 | ReleaseRedirect(c.redirect) |
| 724 | c.redirect = nil |
| 725 | } |
| 726 | c.shouldSkipNonUseRoutes = false |
| 727 | // performance: no need for using c.isAbandoned.Store(false) here, as it is always set to false when it was true in ForceRelease |
| 728 | c.reclaim = nil |
| 729 | c.handlerCtx = nil |
| 730 | } |
| 731 | |
| 732 | // reclaimLatch coordinates the safe, automatic reclamation of an abandoned |
| 733 | // context back into the pool. It is armed only via ScheduleReclaim (currently by |
nothing calls this directly
no test coverage detected