MCPcopy Create free account
hub / github.com/dadgar/onecache / returnClient

Method returnClient

onecache/pool.go:84–95  ·  view source on GitHub ↗

returnStream is used when done with a stream to allow re-use by a future RPC

(client *streamClient)

Source from the content-addressed store, hash-verified

82// returnStream is used when done with a stream
83// to allow re-use by a future RPC
84func (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

Callers 1

RPCMethod · 0.80

Calls 2

LenMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected