mirror of
https://github.com/AlexMacocian/MTSC.git
synced 2026-07-15 23:09:32 +00:00
439b3f160d
Procedures to be run on initialization Fix concurrency issues with listeners
37 lines
1002 B
C#
37 lines
1002 B
C#
using MTSC.ServerSide;
|
|
using MTSC.ServerSide.Handlers;
|
|
using System;
|
|
|
|
namespace MTSC.UnitTests.Models;
|
|
|
|
public sealed class ServiceOnInitialization : IHandler, IRunOnInitialization
|
|
{
|
|
public bool RanOnInitialization { get; private set; }
|
|
|
|
public void OnInitialization(Server server)
|
|
{
|
|
if (this.RanOnInitialization)
|
|
{
|
|
throw new InvalidOperationException("Initialization procedure already ran");
|
|
}
|
|
|
|
this.RanOnInitialization = true;
|
|
}
|
|
|
|
public void ClientRemoved(Server server, ClientData client)
|
|
{
|
|
}
|
|
|
|
public bool HandleClient(Server server, ClientData client) => true;
|
|
|
|
public bool HandleReceivedMessage(Server server, ClientData client, Message message) => false;
|
|
|
|
public bool HandleSendMessage(Server server, ClientData client, ref Message message) => false;
|
|
|
|
public bool PreHandleReceivedMessage(Server server, ClientData client, ref Message message) => false;
|
|
|
|
public void Tick(Server server)
|
|
{
|
|
}
|
|
}
|