diff --git a/internal/cli/arguments/port.go b/internal/cli/arguments/port.go index f1928d1e8d0..35d340d49fb 100644 --- a/internal/cli/arguments/port.go +++ b/internal/cli/arguments/port.go @@ -87,23 +87,22 @@ func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol s } logrus.WithField("port", address).Tracef("Upload port") - dm := pme.DiscoveryManager() - watcher, err := dm.Watch() + watcher, cancel, err := board.Watch(&rpc.BoardListWatchRequest{Instance: instance}) if err != nil { return nil, err } - defer watcher.Close() + defer cancel() deadline := time.After(p.timeout.Get()) for { select { - case portEvent := <-watcher.Feed(): - if portEvent.Type != "add" { + case portEvent := <-watcher: + if portEvent.GetEventType() != "add" { continue } - port := portEvent.Port - if (protocol == "" || protocol == port.Protocol) && address == port.Address { - return port.ToRPC(), nil + port := portEvent.GetPort().GetPort() + if (protocol == "" || protocol == port.GetProtocol()) && address == port.GetAddress() { + return port, nil } case <-deadline: