@@ -153,10 +153,7 @@ void StfSenderDevice::Reset()
153153 DDDLOG (" StfBuilderDevice::Reset()" );
154154
155155 I ().mDeviceRunning = false ;
156- // wait the Info thread, before closing mTfSchedulerRpcClient
157- if (I ().mInfoThread .joinable ()) {
158- I ().mInfoThread .join ();
159- }
156+ // stop the receiver thread
160157 if (I ().mReceiverThread .joinable ()) {
161158 I ().mReceiverThread .join ();
162159 }
@@ -222,11 +219,20 @@ void StfSenderDevice::InitTask()
222219 if (!standalone ()) {
223220 // contact the scheduler on gRPC
224221 while (I ().mTfSchedulerRpcClient .should_retry_start () && !I ().mTfSchedulerRpcClient .start (I ().mDiscoveryConfig )) {
225- std::this_thread::sleep_for (150ms);
222+
223+ // try to reach the scheduler unless we should exit
224+ if (NewStatePending ()) {
225+ IDDLOG (" InitTask: The control system requested abort." );
226+ AbortInitTask ();
227+ ChangeState (fair::mq::Transition::ErrorFound);
228+ return ;
229+ }
230+
231+ std::this_thread::sleep_for (250ms);
226232 }
227233
228234 // Did we fail to connect to the TfScheduler?
229- if (!I ().mTfSchedulerRpcClient .should_retry_start ()) {
235+ if (!I ().mTfSchedulerRpcClient .started ()) {
230236 EDDLOG (" InitTask: Failed to connect to TfScheduler. Exiting." );
231237 ChangeState (fair::mq::Transition::ErrorFound);
232238 return ;
@@ -298,7 +304,7 @@ void StfSenderDevice::ResetTask()
298304{
299305 I ().mRunning = false ;
300306
301- // Stop the pipeline
307+ // Stop the pipeline
302308 I ().stopPipeline ();
303309
304310 // stop the receiver thread
0 commit comments