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

Configuration networking fixes #3832

Merged
merged 3 commits into from
Jun 8, 2024
Merged

Conversation

modmuss50
Copy link
Member

@modmuss50 modmuss50 commented Jun 5, 2024

  • Deprecate ClientConfigurationConnectionEvents.READY as it was incorrectly named, replaced with COMPLETE
  • Add ClientConfigurationConnectionEvents.START, this is fired when the server is ready to recieve configuration packets. During login and reconfigure
  • Remove incorrect assertion causing a crash when reconfiguring.

This should be backported to 1.20.6

Closes #3830
Closes #3821

@modmuss50 modmuss50 added bug Something isn't working fabric-networking Pull requests and issues related to the networking api labels Jun 5, 2024
@zly2006
Copy link

zly2006 commented Jun 5, 2024

Please refer to ae314ad , we have to wait for initial acceptable channels from server, so ClientConfigurationNetworking.canSend could work.

public void onServerReady() {
ClientConfigurationConnectionEvents.START.invoker().onConfigurationStart(this.handler, this.client);
}

@Override
protected void receiveRegistration(boolean register, RegistrationPayload payload) {
super.receiveRegistration(register, payload);
Copy link

Choose a reason for hiding this comment

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

The configuration negotiation flow should be like this, imo:
S2C: LoginSuccessS2CPacket
C2S: EnterConfigurationC2SPacket
S2C: sendInitialChannelRegistrationPacket
S2C: Ping
S: fire ServerConfigurationConnectionEvents.BEFORE_CONFIGURE
C2S: receive initial channels, send back client side channels, fire START event here because we must wait for server initial channels
C2S: Pong
S: receive initial channels, fire ServerConfigurationConnectionEvents.CONFIGURE

so onServerReady() should be called here (in the if block) as we received the initial channels.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I agree ill make these changes. It should also be fired even when connecting to a vanilla server (thus when no channels are recieved)

Copy link
Member Author

Choose a reason for hiding this comment

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

I have updated this to now also trigger the event it if the brand packet is recieved.

@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Jun 8, 2024
…abric/test/networking/client/configuration/NetworkingConfigurationClientTest.java

Co-authored-by: Octol1ttle <[email protected]>
@modmuss50 modmuss50 merged commit 686dcdc into FabricMC:1.21 Jun 8, 2024
4 checks passed
modmuss50 added a commit that referenced this pull request Jun 8, 2024
* Configuration networking fixes

* Review fixes.

* Update fabric-networking-api-v1/src/testmodClient/java/net/fabricmc/fabric/test/networking/client/configuration/NetworkingConfigurationClientTest.java

Co-authored-by: Octol1ttle <[email protected]>

---------

Co-authored-by: Octol1ttle <[email protected]>
(cherry picked from commit 686dcdc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fabric-networking Pull requests and issues related to the networking api merge me please Pull requests that are ready to merge
Projects
None yet
3 participants