Skip to content

Commit cbf2de2

Browse files
committed
Replaced DiscoveryManager.Watch with equivalent gRPC BoardListWatch call
1 parent d1929de commit cbf2de2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Diff for: internal/cli/arguments/port.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,22 @@ func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol s
8787
}
8888
logrus.WithField("port", address).Tracef("Upload port")
8989

90-
dm := pme.DiscoveryManager()
91-
watcher, err := dm.Watch()
90+
watcher, cancel, err := board.Watch(&rpc.BoardListWatchRequest{Instance: instance})
9291
if err != nil {
9392
return nil, err
9493
}
95-
defer watcher.Close()
94+
defer cancel()
9695

9796
deadline := time.After(p.timeout.Get())
9897
for {
9998
select {
100-
case portEvent := <-watcher.Feed():
101-
if portEvent.Type != "add" {
99+
case portEvent := <-watcher:
100+
if portEvent.GetEventType() != "add" {
102101
continue
103102
}
104-
port := portEvent.Port
105-
if (protocol == "" || protocol == port.Protocol) && address == port.Address {
106-
return port.ToRPC(), nil
103+
port := portEvent.GetPort().GetPort()
104+
if (protocol == "" || protocol == port.GetProtocol()) && address == port.GetAddress() {
105+
return port, nil
107106
}
108107

109108
case <-deadline:

0 commit comments

Comments
 (0)