AddClient adds a new client to the balanced clients and returns the new total number of clients.
(c BalancingClient)
| 112 | // AddClient adds a new client to the balanced clients and |
| 113 | // returns the new total number of clients. |
| 114 | func (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. |