Class ServerActor
- Namespace
- Valheim.Testing.GameSessions
- Assembly
- Valheim.Testing.GameSessions.dll
One owned dedicated server, from its plan, through every boot it starts, to its stop. It is the one place a run's
owned server is wired (#258): each boot gets the plan's environment with the session token, its kept logs
(Logs, boot-N), a boot-N.process.json record and recorded commands (connection-N.jsonl)
in the output, waits on the plan's startup events, is strictly pinned (ExpectCommand),
and has test access established before it is handed over (EnsureTestAccess), the
first boot and each Restart() alike. A stop asks the server to quit and kills it only after the plan's
QuitSeconds. Where the boots run is its placement: this machine or a host of the environment,
from the disposable profile PinnedServerRun stages there. Game is the current boot's in-game
handle. Disposing it stops only the server it started.
public sealed class ServerActor : IOwnedServer
- Inheritance
-
objectServerActor
- Implements
Properties
Game
The current boot's in-game handle; the server must have started.
public GameActor Game { get; }
Property Value
Host
The host the server runs on: this machine's own (a local host) or another (--inventory or a campaign); null only for a scripted server.
public IGameHost? Host { get; }
Property Value
LiveLog
The current boot's live BepInEx log, for a scenario's in-run log reads: on this machine only (null when the server runs on another host, where Lobby(GameActor) reads its log there).
public string? LiveLog { get; }
Property Value
- string
Logs
Each boot's kept logs, in boot order, for the teardown scan (ScanLogs(IEnumerable<RunLog>, IReadOnlyDictionary<string, LogClassification>?)) once the server stopped.
public IReadOnlyList<RunLog> Logs { get; }
Property Value
- IReadOnlyList<RunLog>
RuntimeDirectory
The server's profile, where BepInEx writes: a path on Host when it has one.
public string RuntimeDirectory { get; }
Property Value
- string
StartedProcesses
The process ID of every boot this actor started.
public IReadOnlyList<int> StartedProcesses { get; }
Property Value
- IReadOnlyList<int>
Stops
How each boot ended, in boot order, restarts included.
public IReadOnlyList<ProcessStop> Stops { get; }
Property Value
- IReadOnlyList<ProcessStop>
WorldDirectory
The world copy the server saves to: a path on Host when it has one.
public string WorldDirectory { get; }
Property Value
- string
Methods
Dispose()
Stops only the server this actor started (asked to quit first, killed after the plan's quit time).
public void Dispose()
Lobby(GameActor)
The crossplay server's lobby for its current boot server, read from the log the game writes to (the plan's
-logFile file, otherwise BepInEx's), on this machine or on the server's host, within the plan's startup time
(WaitForLobby(GameActor, string, TimeSpan, CancellationToken)). A restarted server opens a new one.
public CrossplayLobby Lobby(GameActor server)
Parameters
serverGameActor
Returns
Restart()
Stops only this server, then starts it again with test access; returns the new boot's actor.
public GameActor Restart()
Returns
Start()
Starts the first boot and returns its strictly pinned, test-access-ready actor (StartAsync()).
public GameActor Start()
Returns
WaitUntilJoinable(GameActor)
Waits until server, this server's current actor, accepts game connections, within the plan's startup deadline.
public void WaitUntilJoinable(GameActor server)
Parameters
serverGameActor