[cdc_stream] Append errors from netstart to status (#9)

So far, errors from the remote netstat process would only be logged in
the asset stream service, for instance when SSH auth failed. However,
the errors were not shown to the client, and that's the most important
thing.

Also adds some feedback to cdc_stream in case of success.
This commit is contained in:
Lutz Justen
2022-11-21 09:07:05 +01:00
committed by GitHub
parent 269fb2be45
commit bccc025945
6 changed files with 43 additions and 30 deletions
+4 -8
View File
@@ -71,12 +71,10 @@ class PortManager {
// forwarding on the local workstation.
// |ip| is the IP address to filter by.
// |process_factory| is used to create a netstat process.
// |forward_output_to_log| determines whether the stderr of netstat is
// forwarded to the logs. Returns ResourceExhaustedError if no port is
// available.
// Returns ResourceExhaustedError if no port is available.
static absl::StatusOr<std::unordered_set<int>> FindAvailableLocalPorts(
int first_port, int last_port, const char* ip,
ProcessFactory* process_factory, bool forward_output_to_log);
ProcessFactory* process_factory);
// Finds available ports in the range [first_port, last_port] for port
// forwarding on the instance.
@@ -84,13 +82,11 @@ class PortManager {
// |process_factory| is used to create a netstat process.
// |remote_util| is used to connect to the instance.
// |timeout_sec| is the connection timeout in seconds.
// |forward_output_to_log| determines whether the stderr of netstat is
// forwarded to the logs. Returns a DeadlineExceeded error if the timeout is
// exceeded. Returns ResourceExhaustedError if no port is available.
// Returns a DeadlineExceeded error if the timeout is exceeded.
// Returns ResourceExhaustedError if no port is available.
static absl::StatusOr<std::unordered_set<int>> FindAvailableRemotePorts(
int first_port, int last_port, const char* ip,
ProcessFactory* process_factory, RemoteUtil* remote_util, int timeout_sec,
bool forward_output_to_log,
SteadyClock* steady_clock = DefaultSteadyClock::GetInstance());
private: