(serverId string)
| 40 | } |
| 41 | |
| 42 | func (rc *RpcConnectClient) GetRpcClientByServerId(serverId string) (c client.XClient, err error) { |
| 43 | rc.lock.Lock() |
| 44 | defer rc.lock.Unlock() |
| 45 | if _, ok := rc.ServerInsMap[serverId]; !ok || len(rc.ServerInsMap[serverId]) <= 0 { |
| 46 | return nil, errors.New("no connect layer ip:" + serverId) |
| 47 | } |
| 48 | if _, ok := rc.IndexMap[serverId]; !ok { |
| 49 | rc.IndexMap = map[string]int{ |
| 50 | serverId: 0, |
| 51 | } |
| 52 | } |
| 53 | idx := rc.IndexMap[serverId] % len(rc.ServerInsMap[serverId]) |
| 54 | ins := rc.ServerInsMap[serverId][idx] |
| 55 | rc.IndexMap[serverId] = (rc.IndexMap[serverId] + 1) % len(rc.ServerInsMap[serverId]) |
| 56 | return ins.Client, nil |
| 57 | } |
| 58 | |
| 59 | func (rc *RpcConnectClient) GetAllConnectTypeRpcClient() (rpcClientList []client.XClient) { |
| 60 | for serverId, _ := range rc.ServerInsMap { |
no outgoing calls
no test coverage detected