Fixed bug in aos::starter::StarterClient::Succeed
To enable support for chaining commands with StarterClient,
it was necessary to change the order that StarterClient::Succeed
was performing its cleanup operations. With the new change,
a downstream function can call StarterClient.SetTimeoutHandler
inside their function that was set as the success callback.
A unit test was added to starter_test.cc to demonstrate that
this change fixes the issue.
Change-Id: I5de0ed99064b0d2550242cd3b3af80748fb25e6b
Signed-off-by: Maxwell Gumley <maxwell.gumley@bluerivertech.com>
Signed-off-by: Austin Schuh <austin.linux@bluerivertech.com>
diff --git a/aos/starter/starterd_lib.cc b/aos/starter/starterd_lib.cc
index b8b7343..30e0887 100644
--- a/aos/starter/starterd_lib.cc
+++ b/aos/starter/starterd_lib.cc
@@ -35,7 +35,10 @@
SendStatus();
status_count_ = 0;
})),
- cleanup_timer_(event_loop_.AddTimer([this] { event_loop_.Exit(); })),
+ cleanup_timer_(event_loop_.AddTimer([this] {
+ event_loop_.Exit();
+ LOG(INFO) << "Starter event loop exit finished.";
+ })),
max_status_count_(
event_loop_.GetChannel<aos::starter::Status>("/aos")->frequency() -
1),