summaryrefslogtreecommitdiff
path: root/PollingTransceiver.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2019-06-02 22:17:11 +0200
committerChristoph Berg <myon@debian.org>2019-06-02 22:17:11 +0200
commit851b658298afb9bafeda98ffbfa2ade612c656be (patch)
tree826d54e9dac4ce15fdd1b6af3360eeba7993a7d2 /PollingTransceiver.cpp
parentb7238399ea4f1ca51d8f7b8f9220af3da0913edf (diff)
New upstream version 2.1.0~rc6+repackupstream/2.1.0_rc6+repack
Diffstat (limited to 'PollingTransceiver.cpp')
-rw-r--r--PollingTransceiver.cpp70
1 files changed, 32 insertions, 38 deletions
diff --git a/PollingTransceiver.cpp b/PollingTransceiver.cpp
index b2bbab17..ed47144a 100644
--- a/PollingTransceiver.cpp
+++ b/PollingTransceiver.cpp
@@ -129,52 +129,46 @@ bool PollingTransceiver::do_pre_update ()
return true;
}
-void PollingTransceiver::do_sync (bool force_signal, bool no_poll)
-{
- if (!no_poll) poll (); // tell sub-classes to update our state
-
- // Signal new state if it is directly requested or, what we expected
- // or, hasn't become what we expected after polls_to_stabilize
- // polls. Unsolicited changes will be signalled immediately unless
- // they intervene in a expected sequence where they will be delayed.
- if (retries_)
- {
- --retries_;
- if (force_signal || state () == next_state_ || !retries_)
- {
- // our client wants a signal regardless
- // or the expected state has arrived
- // or there are no more retries
- force_signal = true;
- }
- }
- else if (force_signal || state () != last_signalled_state_)
- {
- // here is the normal passive polling path either our client has
- // requested a state update regardless of change or state has
- // changed asynchronously
- force_signal = true;
- }
-
- if (force_signal)
- {
- // reset everything, record and signal the current state
- retries_ = 0;
- next_state_ = state ();
- last_signalled_state_ = state ();
- update_complete (true);
- }
-}
-
void PollingTransceiver::handle_timeout ()
{
QString message;
+ bool force_signal {false};
// we must catch all exceptions here since we are called by Qt and
// inform our parent of the failure via the offline() message
try
{
- do_sync ();
+ do_poll (); // tell sub-classes to update our state
+
+ // Signal new state if it what we expected or, hasn't become
+ // what we expected after polls_to_stabilize polls. Unsolicited
+ // changes will be signalled immediately unless they intervene
+ // in a expected sequence where they will be delayed.
+ if (retries_)
+ {
+ --retries_;
+ if (state () == next_state_ || !retries_)
+ {
+ // the expected state has arrived or there are no more
+ // retries
+ force_signal = true;
+ }
+ }
+ else if (state () != last_signalled_state_)
+ {
+ // here is the normal passive polling path where state has
+ // changed asynchronously
+ force_signal = true;
+ }
+
+ if (force_signal)
+ {
+ // reset everything, record and signal the current state
+ retries_ = 0;
+ next_state_ = state ();
+ last_signalled_state_ = state ();
+ update_complete (true);
+ }
}
catch (std::exception const& e)
{