Skip to content

Commit

Permalink
fix: pool bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxu19830126 committed Apr 28, 2018
1 parent 1c08bcc commit 420f370
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions pkg/proxy/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ func acquireMultiContext() *multiContext {
}

func releaseMultiContext(value *multiContext) {
value.reset()
multiContextPool.Put(value)
if value != nil {
value.reset()
multiContextPool.Put(value)
}
}

func acquireDispathNode() *dispathNode {
Expand All @@ -42,8 +44,10 @@ func acquireDispathNode() *dispathNode {
}

func releaseDispathNode(value *dispathNode) {
value.reset()
dispathNodePool.Put(value)
if value != nil {
value.reset()
dispathNodePool.Put(value)
}
}

func acquireContext() *proxyContext {
Expand All @@ -56,8 +60,10 @@ func acquireContext() *proxyContext {
}

func releaseContext(value *proxyContext) {
value.reset()
contextPool.Put(value)
if value != nil {
value.reset()
contextPool.Put(value)
}
}

func acquireRender() *render {
Expand All @@ -70,6 +76,8 @@ func acquireRender() *render {
}

func releaseRender(value *render) {
value.reset()
renderPool.Put(value)
if value != nil {
value.reset()
renderPool.Put(value)
}
}

0 comments on commit 420f370

Please sign in to comment.