MCPcopy
hub / github.com/valyala/fasthttp / AddClient

Method AddClient

lbclient.go:114–122  ·  view source on GitHub ↗

AddClient adds a new client to the balanced clients and returns the new total number of clients.

(c BalancingClient)

Source from the content-addressed store, hash-verified

112// AddClient adds a new client to the balanced clients and
113// returns the new total number of clients.
114func (cc *LBClient) AddClient(c BalancingClient) int {
115 cc.mu.Lock()
116 defer cc.mu.Unlock()
117 cc.cs = append(cc.cs, &lbClient{
118 c: c,
119 healthCheck: cc.HealthCheck,
120 })
121 return len(cc.cs)
122}
123
124// RemoveClients removes clients using the provided callback.
125// If rc returns true, the passed client will be removed.

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65