Skip to content

Commit 7673d8f

Browse files
committed
Added Close request to gRPC Monitor API
1 parent a5d896a commit 7673d8f

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
@@ -501,6 +501,11 @@ func (s *ArduinoCoreServerImpl) Monitor(stream rpc.ArduinoCoreService_MonitorSer
501501
}
502502
}
503503
}
504+
if close := msg.GetClose(); close {
505+
if err := portProxy.Close(); err != nil {
506+
logrus.WithError(err).Debug("Error closing monitor port")
507+
}
508+
}
504509
tx := msg.GetTxData()
505510
for len(tx) > 0 {
506511
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)