mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
Merge pull request #1452 from hashicorp/f-shrink
consul: shrink yamux recv buffer on idle streams
This commit is contained in:
commit
f109e72390
@ -103,6 +103,12 @@ func (c *Conn) returnClient(client *StreamClient) {
|
||||
if c.clients.Len() < c.pool.maxStreams && atomic.LoadInt32(&c.shouldClose) == 0 {
|
||||
c.clients.PushFront(client)
|
||||
didSave = true
|
||||
|
||||
// If this is a Yamux stream, shrink the internal buffers so that
|
||||
// we can GC the idle memory
|
||||
if ys, ok := client.stream.(*yamux.Stream); ok {
|
||||
ys.Shrink()
|
||||
}
|
||||
}
|
||||
c.clientLock.Unlock()
|
||||
if !didSave {
|
||||
|
Loading…
x
Reference in New Issue
Block a user