aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorGravatar tyltr <tylitianrui@126.com> 2022-03-18 15:19:34 +0800
committerGravatar GitHub <noreply@github.com> 2022-03-18 08:19:34 +0100
commit2044e1e9985fafb78bc03fffa5290a186ee5d3af (patch)
tree1b86b2e1becae91d7416fc31c7130c4fc12bb02d /client.go
parentImporve AppendHTMLEscape fast path (#1249) (diff)
downloadfasthttp-2044e1e9985fafb78bc03fffa5290a186ee5d3af.tar.gz
fasthttp-2044e1e9985fafb78bc03fffa5290a186ee5d3af.tar.bz2
fasthttp-2044e1e9985fafb78bc03fffa5290a186ee5d3af.zip
reduce unnessary type assart (#1254)
Diffstat (limited to 'client.go')
-rw-r--r--client.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/client.go b/client.go
index e3173be..ee05507 100644
--- a/client.go
+++ b/client.go
@@ -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)