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

Function newPool

onecache/pool.go:132–145  ·  view source on GitHub ↗

newPool is used to make a new connection pool Maintain at most one connection per host, for up to maxTime. Set maxTime to 0 to disable reaping. maxStreams is used to control the number of idle streams allowed.

(logOutput io.Writer, maxTime time.Duration, maxStreams int)

Source from the content-addressed store, hash-verified

130// Set maxTime to 0 to disable reaping. maxStreams is used to control
131// the number of idle streams allowed.
132func newPool(logOutput io.Writer, maxTime time.Duration, maxStreams int) *connPool {
133 pool := &connPool{
134 logOutput: logOutput,
135 maxTime: maxTime,
136 maxStreams: maxStreams,
137 pool: make(map[string]*conn),
138 limiter: make(map[string]chan struct{}),
139 shutdownCh: make(chan struct{}),
140 }
141 if maxTime > 0 {
142 go pool.reap()
143 }
144 return pool
145}
146
147// Shutdown is used to close the connection pool
148func (p *connPool) Shutdown() error {

Callers 1

newRpcServerFunction · 0.85

Calls 1

reapMethod · 0.95

Tested by

no test coverage detected