Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor server orders #19447

Merged
merged 1 commit into from Jul 3, 2021
Merged

Refactor server orders #19447

merged 1 commit into from Jul 3, 2021

Conversation

teinarss
Copy link
Contributor

Changing on how the disconnect order is sent from the server, ie not relying on spoofing the from client. Also did some cleanup around dispatching server orders.

OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
@teinarss
Copy link
Contributor Author

Updated, not sure how we want to handle protocol version, increase it in every PR that changes stuff or in one final PR after all these PR have been merged?

@jrb0001
Copy link
Contributor

jrb0001 commented Jun 19, 2021

If you don't increase the protocol version in every PR then thirdparty mods might run into a version/implementation mismatch which can lead to strange problems. So it would be best to either merge all PRs at the same time or to increase it in every PR.

@abcdefg30
Copy link
Member

Tbh I still think tools depending on bleed versions is kind of an anti-feature, but our order version is an int which means we can be generous with increasing it.

@teinarss
Copy link
Contributor Author

Updated

Copy link
Member

@pchote pchote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from spoofing the disconnect order sender to having it explicitly sent by the server seems like a good idea. I don't see the advantage for wrapping it in a serialized Order though, this seems to add a lot of complexity and redundancy compared to making OrderType.Disconnect carry just the clientID the same way OrderType.SyncHash carries the sync state.

If we do want to keep the Order wrapping can we please change some of my suggestions below to make the code a bit more self explanatory?

OpenRA.Game/Network/Order.cs Outdated Show resolved Hide resolved
OpenRA.Game/Network/Order.cs Outdated Show resolved Hide resolved
OpenRA.Game/Network/OrderManager.cs Outdated Show resolved Hide resolved
OpenRA.Game/Network/OrderManager.cs Outdated Show resolved Hide resolved
OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
@teinarss
Copy link
Contributor Author

teinarss commented Jul 1, 2021

Updated.

OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
OpenRA.Game/Network/OrderManager.cs Outdated Show resolved Hide resolved
OpenRA.Game/Server/Server.cs Show resolved Hide resolved
OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
@@ -131,8 +131,12 @@ public void TickImmediate()
return;

var frame = BitConverter.ToInt32(packet, 0);
if (packet.Length == 5 && packet[4] == (byte)OrderType.Disconnect)
pendingPackets.Remove(clientId);
if (packet.Length == Order.DisconnectOrderLength + 4 && packet[4] == (byte)OrderType.Disconnect)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird that the server code treats OrderType as the first byte in the data payload rather than as part of the framing. Fixing this isn't trivial because the OrderType handling is split half between the network code and half inside Order, so best that we leave this to a future PR.

@teinarss
Copy link
Contributor Author

teinarss commented Jul 1, 2021

Updated

jrb0001
jrb0001 previously approved these changes Jul 1, 2021
Copy link
Contributor

@jrb0001 jrb0001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protocol implementation looks fine to me.

@teinarss
Copy link
Contributor Author

teinarss commented Jul 3, 2021

Updated

pchote
pchote previously approved these changes Jul 3, 2021
OpenRA.Game/Server/Server.cs Outdated Show resolved Hide resolved
@teinarss
Copy link
Contributor Author

teinarss commented Jul 3, 2021

Updated.

@pchote pchote merged commit 1f13735 into OpenRA:bleed Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants