mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Merge branch 'master' of https://github.com/labstack/echo
This commit is contained in:
commit
aa483fd34f
9
echo.go
9
echo.go
@ -70,6 +70,7 @@ type (
|
||||
Validator Validator
|
||||
Renderer Renderer
|
||||
AutoTLSManager autocert.Manager
|
||||
Mutex sync.RWMutex
|
||||
Logger Logger
|
||||
stdLogger *slog.Logger
|
||||
colorer *color.Color
|
||||
@ -497,7 +498,13 @@ func (e *Echo) ReleaseContext(c Context) {
|
||||
|
||||
// ServeHTTP implements `http.Handler` interface, which serves HTTP requests.
|
||||
func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// Acquire lock
|
||||
e.Mutex.RLock()
|
||||
defer e.Mutex.RUnlock()
|
||||
|
||||
// Acquire context
|
||||
c := e.pool.Get().(*context)
|
||||
defer e.pool.Put(c)
|
||||
c.Reset(r, w)
|
||||
|
||||
// Middleware
|
||||
@ -521,8 +528,6 @@ func (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if err := h(c); err != nil {
|
||||
e.HTTPErrorHandler(err, c)
|
||||
}
|
||||
|
||||
e.pool.Put(c)
|
||||
}
|
||||
|
||||
// Start starts an HTTP server.
|
||||
|
Loading…
Reference in New Issue
Block a user