diff options
author | tyltr <tylitianrui@126.com> | 2022-03-18 15:19:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 08:19:34 +0100 |
commit | 2044e1e9985fafb78bc03fffa5290a186ee5d3af (patch) | |
tree | 1b86b2e1becae91d7416fc31c7130c4fc12bb02d /client.go | |
parent | Imporve AppendHTMLEscape fast path (#1249) (diff) | |
download | fasthttp-2044e1e9985fafb78bc03fffa5290a186ee5d3af.tar.gz fasthttp-2044e1e9985fafb78bc03fffa5290a186ee5d3af.tar.bz2 fasthttp-2044e1e9985fafb78bc03fffa5290a186ee5d3af.zip |
reduce unnessary type assart (#1254)
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -2916,14 +2916,15 @@ func (c *pipelineConnClient) getClientName() []byte { var errPipelineConnStopped = errors.New("pipeline connection has been stopped") -func acquirePipelineWork(pool *sync.Pool, timeout time.Duration) *pipelineWork { +func acquirePipelineWork(pool *sync.Pool, timeout time.Duration) (w *pipelineWork) { v := pool.Get() - if v == nil { - v = &pipelineWork{ + if v != nil { + w = v.(*pipelineWork) + } else { + w = &pipelineWork{ done: make(chan struct{}, 1), } } - w := v.(*pipelineWork) if timeout > 0 { if w.t == nil { w.t = time.NewTimer(timeout) |