YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.fcast.protocol.FCastHeartbeat Class Reference

When to ping a receiver and when to give it up (pure, driven by a clock value, so tests do not sleep). More...

Collaboration diagram for de.yaacc.fcast.protocol.FCastHeartbeat:
Collaboration graph

Classes

enum  Action
 What to do now. More...
 

Public Member Functions

 FCastHeartbeat (long now, long pingAfterMillis, long deadAfterMillis)
 
void onPacket (long now)
 A packet arrived (any opcode).
 
Action tick (long now)
 

Detailed Description

When to ping a receiver and when to give it up (pure, driven by a clock value, so tests do not sleep).

The receivers ping a sender themselves (the desktop receiver after 3 s of silence and it ends the session after 6 s, the Android receiver every 2.5 s, see docs/tech.md); this class covers the receiver that does not: after pingAfter without any packet it asks for one Ping, after deadAfter without any packet the connection is dead. Any packet, whatever it is, counts as life. A Ping is asked for once per silence, not again until a packet came. Not thread safe: the watchdog thread.

Constructor & Destructor Documentation

◆ FCastHeartbeat()

de.yaacc.fcast.protocol.FCastHeartbeat.FCastHeartbeat ( long now,
long pingAfterMillis,
long deadAfterMillis )
Parameters
nowthe clock when the connection was made
pingAfterMillissilence after which one Ping is sent
deadAfterMillissilence after which the connection is given up (more than pingAfterMillis)

Member Function Documentation

◆ tick()

Action de.yaacc.fcast.protocol.FCastHeartbeat.tick ( long now)
Returns
what to do at this time; PING is returned once per silence

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