1
0
Fork 0

remove redundant local variable

This commit is contained in:
Kevin Matz 2022-12-02 15:35:08 -05:00
parent a443299204
commit be17ea9bb5
2 changed files with 6 additions and 9 deletions

View File

@ -84,8 +84,9 @@ class Universe {
void doDataCallbacks(); //!< execute data changed callbacks
void doStatusCallbacks(); //!< execute status changed callbacks
std::chrono::system_clock::time_point last_updated_; //!< time of the latest update
private:
std::chrono::system_clock::time_point last_updated_;
std::queue<std::chrono::time_point<std::chrono::system_clock>> rx_times_;
void rx_timeout_(bool add_now = false);

View File

@ -451,8 +451,6 @@ void Universe::tx_loop_()
/// > intervals of between 800mS and 1000mS.
std::chrono::milliseconds keep_alive_interval(800);
std::chrono::system_clock::time_point last_sent;
// I don't fully understand the semantics of std::conditional_variable,
// but it requires this mutex in the sleeping thread.
std::mutex mtx;
@ -460,7 +458,7 @@ void Universe::tx_loop_()
while (enable || terminated_resend >= 0)
{
// enforce strict minimum update times
auto elapsed = std::chrono::system_clock::now() - last_sent;
auto elapsed = std::chrono::system_clock::now() - last_updated_;
if (elapsed < minimum_update_time)
std::this_thread::sleep_for(minimum_update_time - elapsed);
@ -470,13 +468,11 @@ void Universe::tx_loop_()
tx_control_mutex_.unlock();
if (enable)
{
setStatus(Status::DMX_ACTIVE);
}
setStatus(DMX_ACTIVE);
else
{
provenance_->options.stream_terminated = true; // set the stream_terminated bit
setStatus(Status::sACN_TERMINATED); // note the changed operating status
setStatus(sACN_TERMINATED); // note the changed operating status
terminated_resend--; // stream_terminated must be sent 3 times
retransmission_count = 0; // stay throttled up through the termination sequence
}
@ -499,7 +495,7 @@ void Universe::tx_loop_()
// send the sACN message
sACNsend();
last_sent = std::chrono::system_clock::now();
last_updated_ = std::chrono::system_clock::now();
// sleep before the next cycle
tx_request_.wait_for(mtx, sleep);