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

@@ -167,12 +167,12 @@ namespace OpenRA.Network
{
var networkStream = (NetworkStream)networkStreamObject;
var reader = new BinaryReader(networkStream);
var serverProtocol = reader.ReadInt32();
var handshakeProtocol = reader.ReadInt32();
if (serverProtocol != ProtocolVersion.Version)
if (handshakeProtocol != ProtocolVersion.Handshake)
throw new InvalidOperationException(
"Protocol version mismatch. Server={0} Client={1}"
.F(serverProtocol, ProtocolVersion.Version));
"Handshake protocol version mismatch. Server={0} Client={1}"
.F(handshakeProtocol, ProtocolVersion.Handshake));
clientId = reader.ReadInt32();
connectionState = ConnectionState.Connected;

View File

@@ -41,6 +41,10 @@ namespace OpenRA.Network
public string Version;
public string Password;
// Default value is hardcoded to 7 so that newer servers
// (which define OrdersProtocol > 7) can detect older clients
public int OrdersProtocol = 7;
// For player authentication
public string Fingerprint;
public string AuthSignature;
@@ -74,7 +78,7 @@ namespace OpenRA.Network
{
var data = new List<MiniYamlNode>();
data.Add(new MiniYamlNode("Handshake", null,
new string[] { "Mod", "Version", "Password", "Fingerprint", "AuthSignature" }.Select(p => FieldSaver.SaveField(this, p)).ToList()));
new[] { "Mod", "Version", "Password", "Fingerprint", "AuthSignature", "OrdersProtocol" }.Select(p => FieldSaver.SaveField(this, p)).ToList()));
data.Add(new MiniYamlNode("Client", FieldSaver.Save(Client)));
return data.WriteToString();

View File

@@ -227,7 +227,8 @@ namespace OpenRA.Network
Mod = mod.Id,
Version = mod.Metadata.Version,
Password = orderManager.Password,
Fingerprint = localProfile.Fingerprint
Fingerprint = localProfile.Fingerprint,
OrdersProtocol = ProtocolVersion.Orders
};
if (request.AuthToken != null && response.Fingerprint != null)