mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 23:09:20 +02:00
hardware protocol v2: sessions, subscriptions and the transport worker
Adds the logical protocol layer on top of the frame codec: session handshake with negotiated frame size, session scoped symbol handles, state subscriptions with periodic, on change and deadband filtering, command events with duplicate protection and continuous controls with stale update rejection, plus per connection rate limits and diagnostics. A single worker thread owns all of the blocking transport work and exchanges finished frames with the simulation thread through short locked queues, so a stalled, flooding or unplugged controller cannot hold up the simulation.
This commit is contained in:
28
hardware/diagnostics/hardware_diagnostics.cpp
Normal file
28
hardware/diagnostics/hardware_diagnostics.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "hardware/diagnostics/hardware_diagnostics.h"
|
||||
|
||||
namespace hardware
|
||||
{
|
||||
|
||||
void rate_counter::update( double const Deltatime )
|
||||
{
|
||||
m_window += Deltatime;
|
||||
if( m_window < 1.0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_rate = static_cast<float>( m_accumulator / m_window );
|
||||
m_accumulator = 0;
|
||||
m_window = 0.0;
|
||||
}
|
||||
|
||||
} // namespace hardware
|
||||
Reference in New Issue
Block a user