Skip to content

fix: Server was able to be mapped as both ID 0 and ID 1 #1597

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

Closed
wants to merge 3 commits into from

Conversation

ShadauxCat
Copy link
Collaborator

@ShadauxCat ShadauxCat commented Jan 18, 2022

This meant the first client to connect could sometimes see messages from the server as coming from itself, and could successfully send to its own LocalClientId (even though the message would go to the server). Other clients would be able to send and receive from id 1, but that would also be the server.

MTT-1536
MTT-1691

Changelog

com.unity.netcode.gameobjects

  • Fixed: Fixed an issue where sometimes the first client to connect to the server could see messages from the server as coming from itself.
  • Fixed: Fixed an issue where clients seemed to be able to send messages to ClientId 1, but these messages would actually still go to the server (id 0) instead of that client.
  • Fixed: Improved clarity of error messaging when a client attempts to send a message to a destination other than the server, which isn't allowed.

Testing and Documentation

  • No tests have been added.
  • No documentation changes or additions were necessary.

This meant the first client to connect could sometimes see messages from the server as coming from itself, and could successfully send to its own LocalClientId (even though the message would go to the server). Other clients would be able to send and receive from id 1, but that would also be the server.
@ShadauxCat ShadauxCat changed the title Fix: Server was able to be mapped as both ID 0 and ID 1 fix: Server was able to be mapped as both ID 0 and ID 1 Jan 18, 2022
@josiemessa
Copy link
Contributor

Have tested this out on my test project, and can now see messages being received from the server when we profile the client. I am now getting spammed with these errors but I think that's OK as the code I was using to test this is now invalid:

ArgumentException: Clients may only send messages to ServerClientId
Unity.Netcode.NetworkManager.SendMessage[T] (T& message, Unity.Netcode.NetworkDelivery delivery, System.UInt64 clientId) (at C:/dev/src/github.com/Unity-Technologies/com.unity.netcode.gameobjects/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs:1517)
Unity.Netcode.CustomMessagingManager.SendNamedMessage (System.String messageName, System.UInt64 clientId, Unity.Netcode.FastBufferWriter messageStream, Unity.Netcode.NetworkDelivery networkDelivery) (at C:/dev/src/github.com/Unity-Technologies/com.unity.netcode.gameobjects/com.unity.netcode.gameobjects/Runtime/Messaging/CustomMessageManager.cs:228)
Player.Update () (at Assets/Scripts/Network/Player.cs:54)

@ShadauxCat
Copy link
Collaborator Author

Reopened as #1683

@ShadauxCat ShadauxCat closed this Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants