Split Protocol version into Handshake vs Orders.

Handshake is kept at 7.
Orders is incremented to 8 to reflect immediate order changes.
This commit is contained in:
Paul Chote
2019-05-31 19:03:49 +00:00
committed by abcdefg30
parent fe41dcb45e
commit c6232f20f9
5 changed files with 30 additions and 9 deletions

View File

@@ -278,7 +278,7 @@ namespace OpenRA.Server
// Send handshake and client index.
var ms = new MemoryStream(8);
ms.WriteArray(BitConverter.GetBytes(ProtocolVersion.Version));
ms.WriteArray(BitConverter.GetBytes(ProtocolVersion.Handshake));
ms.WriteArray(BitConverter.GetBytes(newConn.PlayerIndex));
SendData(newConn.Socket, ms.ToArray());
@@ -363,6 +363,16 @@ namespace OpenRA.Server
return;
}
if (handshake.OrdersProtocol != ProtocolVersion.Orders)
{
Log.Write("server", "Rejected connection from {0}; incompatible Orders protocol version {1}.",
newConn.Socket.RemoteEndPoint, handshake.OrdersProtocol);
SendOrderTo(newConn, "ServerError", "Server is running an incompatible protocol");
DropClient(newConn);
return;
}
// Check if IP is banned
var bans = Settings.Ban.Union(TempBans);
if (bans.Contains(client.IpAddress))