Skip to content

Commit

Permalink
send server init after the client init
Browse files Browse the repository at this point in the history
To make service discovery by internet scan bots harder.
  • Loading branch information
Istador authored and Sanae6 committed Apr 27, 2024
1 parent dc20a9c commit 9511d07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Server/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ private async void HandleSocket(Socket socket) {
Client client = new Client(socket) {Server = this};
var remote = socket.RemoteEndPoint;
IMemoryOwner<byte> memory = null!;
await client.Send(new InitPacket {
MaxPlayers = Settings.Instance.Server.MaxPlayers
});

bool first = true;
try {
Expand Down Expand Up @@ -206,6 +203,11 @@ async Task<bool> Read(Memory<byte> readMem, int readSize, int readOffset) {
continue;
}

// send server init
await client.Send(new InitPacket {
MaxPlayers = Settings.Instance.Server.MaxPlayers,
});

bool wasFirst = connect.ConnectionType == ConnectPacket.ConnectionTypes.FirstConnection;

// add client to the set of connected players
Expand Down

0 comments on commit 9511d07

Please sign in to comment.