returnStream is used when done with a stream to allow re-use by a future RPC
(client *streamClient)
| 82 | // returnStream is used when done with a stream |
| 83 | // to allow re-use by a future RPC |
| 84 | func (c *conn) returnClient(client *streamClient) { |
| 85 | didSave := false |
| 86 | c.clientLock.Lock() |
| 87 | if c.clients.Len() < c.pool.maxStreams && atomic.LoadInt32(&c.shouldClose) == 0 { |
| 88 | c.clients.PushFront(client) |
| 89 | didSave = true |
| 90 | } |
| 91 | c.clientLock.Unlock() |
| 92 | if !didSave { |
| 93 | client.Close() |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | // connPool is used to maintain a connection pool to other |
| 98 | // Nomad servers. This is used to reduce the latency of |