Skip to main content

ServerHeartbeat

A class in Root.Township, the global namespace.

Starts an external heartbeat monitor process for a dedicated server and logs a heartbeat line every 100 frames. Server, only with the /heartbeat command line argument.

Constructors​

MemberWhat it is
ServerHeartbeat()Creates a ServerHeartbeat with default values.

Fields​

5 private and internal fields
MemberWhat it is
private int countFrames since the last heartbeat.
private static Process heartbeatMonitorProcessThe external monitor process.
private static Logger loggerNLog logger for this class.
private IUnityUpdateMethod sendingLoopHandle for the registered SendHeartbeatLoop method.
private static int sendIntervalFrames between heartbeats (100).

Properties​

1 private and internal property
MemberWhat it is
private static bool IsActive { get; set; }True between StartSending and Shutdown.

Methods​

MemberWhat it is
static void Shutdown()Kills the heartbeat monitor process, or the first process named ServerHeartbeat if that fails. Called on application quit.
void StartSending(string serverName)Starts the monitor and the heartbeat loop. Called by ServerHandler after the server starts.
void StopSending()Stops the heartbeat loop and shuts the monitor down.
3 private and internal methods
MemberWhat it is
private void SendHeartbeat()Writes a trace-level heartbeat log line. Nothing is sent over the network.
private void SendHeartbeatLoop()Per-frame update that calls SendHeartbeat every sendInterval frames.
private void StartHeartbeatMonitor(string serverName)Starts the monitor from the /heartbeat path and alert interval arguments, passing it the server name, PID and command line.

Used in​

Members of other types that take, return or hold a ServerHeartbeat: