Rebel Fork Framework
Urho3D::ClockSynchronizer Class Reference

Classes

struct  PendingPing
 
struct  PendingPong
 

Public Member Functions

 ClockSynchronizer (unsigned pingIntervalMs, unsigned maxPingMs, unsigned clockBufferSize, unsigned pingBufferSize, ea::function< unsigned()> getTimestamp=nullptr)
 
void ProcessMessage (const ClockSynchronizerMessage &msg)
 Process incoming message. Should be called as soon as possible.
 
ea::optional< ClockSynchronizerMessagePollMessage ()
 Receive outgoing message if there is any. Should be called as late as possible.
 
bool IsReady () const
 Return whether synchronizer is ready to use.
 
unsigned LocalToRemote (unsigned value) const
 Convert from local to remote timestamp.
 
unsigned RemoteToLocal (unsigned value) const
 Convert from remote to local timestamp.
 
unsigned GetPing () const
 Return ping, i.e. half of round-trip delay excluding remote processing time.
 
unsigned GetLocalTimeOfLatestRoundtrip () const
 Return local timestamp of the latest successful roundtrip.
 

Private Member Functions

ClockSynchronizerMessage CreateNewPing (unsigned now)
 
ClockSynchronizerMessage CreateNewPong (const PendingPong &pong)
 
void CleanupExpiredPings (unsigned now)
 
unsigned GetTimestamp () const
 
void UpdateClocks (unsigned localSent, unsigned remoteReceived, unsigned remoteSent, unsigned localReceived)
 

Private Attributes

const ea::function< unsigned()> getTimestamp_
 
const unsigned pingIntervalMs_ {}
 
const unsigned maxPingMs_ {}
 
ea::optional< unsigned > latestProbeTimestamp_
 
ea::vector< PendingPingpendingPings_
 
ea::vector< PendingPongpendingPongs_
 
FilteredUint localToRemote_
 
FilteredUint roundTripDelay_
 
ea::optional< unsigned > latestRoundtripTimestamp_
 

The documentation for this class was generated from the following files: