diff --git a/lego/sys/rpcx/service.go b/lego/sys/rpcx/service.go index 598f3bf23..408e958e5 100644 --- a/lego/sys/rpcx/service.go +++ b/lego/sys/rpcx/service.go @@ -352,18 +352,18 @@ func (this *Service) call(ctx context.Context, clusterTag string, servicePath st err = fmt.Errorf("on found serviceTag:%s", clusterTag) return } - this.clientmutex.RLock() + if clientaddr = selector.Select(ctx, spath[0], serviceMethod, args); clientaddr == "" { err = fmt.Errorf("on found servicePath:%s", servicePath) + return + } + this.clientmutex.RLock() + if conn, ok = this.clients[clientaddr]; !ok { + err = fmt.Errorf("on found clientaddr:%s", clientaddr) this.clientmutex.RUnlock() return } this.clientmutex.RUnlock() - if conn, ok = this.clients[clientaddr]; !ok { - err = fmt.Errorf("on found clientaddr:%s", clientaddr) - return - } - _call = new(client.Call) _call.ServicePath = servicePath _call.ServiceMethod = serviceMethod