Class ServerShutdown

Namespace
Unity.Multiplayer.Core

A clean shutdown, requested once from any thread (a SIGTERM or SIGINT handler, the stop admin command, a quit) and carried out on the game's thread: stop taking players, let the game save, close the session, quit, with a deadline after which the process quits anyway.

public sealed class ServerShutdown
Inheritance
ServerShutdown
Inherited Members

Properties

IsRequested

True once Request(string, double) has been called.

public bool IsRequested { get; }

Property Value

bool

Reason

Why the first request came; null before one.

public string Reason { get; }

Property Value

string

RequestedAt

When the first request came, on the clock passed to Request(string, double).

public double RequestedAt { get; }

Property Value

double

Methods

IsOverdue(double, double)

True when a shutdown was requested more than graceSeconds before now.

public bool IsOverdue(double now, double graceSeconds)

Parameters

now double
graceSeconds double

Returns

bool

Request(string, double)

Asks for a shutdown. Only the first call counts; it returns true, later ones false.

public bool Request(string reason, double now)

Parameters

reason string

Why, for the log (SIGTERM, admin stop).

now double

The time on the caller's clock, for IsOverdue(double, double).

Returns

bool