Skip to content

Commit b18caf7

Browse files
committed
Added Close request to gRPC Monitor API
1 parent dfdd79f commit b18caf7

File tree

3 files changed

+103
-74
lines changed

3 files changed

+103
-74
lines changed

commands/daemon/daemon.go

+5
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,11 @@ func (s *ArduinoCoreServerImpl) Monitor(stream rpc.ArduinoCoreService_MonitorSer
469469
}
470470
}
471471
}
472+
if close := msg.GetClose(); close {
473+
if err := portProxy.Close(); err != nil {
474+
logrus.WithError(err).Debug("Error closing monitor port")
475+
}
476+
}
472477
tx := msg.GetTxData()
473478
for len(tx) > 0 {
474479
n, err := portProxy.Write(tx)

rpc/cc/arduino/cli/commands/v1/monitor.pb.go

+94-74
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/cli/commands/v1/monitor.proto

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ message MonitorRequest {
3030
bytes tx_data = 2;
3131
// Port configuration, contains settings of the port to be changed
3232
MonitorPortConfiguration updated_configuration = 3;
33+
// Close message, set to true to gracefully close a port (this ensure
34+
// that the gRPC streaming call is closed by the daemon AFTER the port
35+
// has been successfully closed)
36+
bool close = 4;
3337
}
3438
}
3539

0 commit comments

Comments
 (0)