Skip to content

feat: Update UTP to 1.4 and add ability to set UTP's MTU #2716

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

Merged
merged 8 commits into from
Oct 4, 2023

Conversation

simon-lemay-unity
Copy link
Contributor

Update UTP to 1.4. Since that version (and the newly-released 2.1) support setting the MTU at the transport level, add an API to configure that. The parameter can only be changed programmatically (it's not serialized) because we don't want users randomly messing with this value. It's really only meant for users that know what they're doing. For example we've had a few users report issues in restricted network environments where the MTU is abnormally low.

Changelog

  • Added: Added MTU property to UnityTransport, which controls the low-level maximum datagram size that the transport will send. Unlike the MTU-related methods described below, this low-level MTU also applies to the individual chunks of a fragmented message. Typically there should be no need to change it unless you know your application is operating in an environment with an abnormally low MTU.
  • Changed: Updated dependency on com.unity.transport to version 1.4.0.

Testing and Documentation

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

@ShadauxCat
Copy link
Collaborator

NetworkManager has a MaximumTransmissionUnit property which controls how big a single batch of messages can be before it gets passed to the transport. Should that be tied into this value in some way?

NetworkManager also has the ability to set this value per-peer based on MTU negotiation. Should UTP also support that?

@simon-lemay-unity
Copy link
Contributor Author

NetworkManager has a MaximumTransmissionUnit property which controls how big a single batch of messages can be before it gets passed to the transport. Should that be tied into this value in some way?

I hadn't noticed this. Should be pretty simple to use that instead of introducing a different knob in the transport itself.

NetworkManager also has the ability to set this value per-peer based on MTU negotiation. Should UTP also support that?

UTP itself doesn't have per-peer MTU. It might be possible to somewhat mimic the functionality in the UnityTransport wrapper, but there are cases where we won't be able to. For example, fragmented unreliable messages are split in MTU-sized chunks. But since that happens inside UTP, we can't do anything about it in the wrapper. I think for now the simplest solution is to have UnityTransport honor the MaximumTransmissionUnitSize value from NetworkManager, but not the per-peer MTUs.

@simon-lemay-unity
Copy link
Contributor Author

Actually was easier than I thought to add support for peer MTUs in the wrapper, so I did that. It only works for reliable sends, but I think that's okay because that's the majority of NGO traffic. Plus for unreliable sends, the peer MTU support in NGO itself should ensure no messages larger than the MTU get to the transport.

@simon-lemay-unity simon-lemay-unity enabled auto-merge (squash) October 4, 2023 13:43
@simon-lemay-unity simon-lemay-unity merged commit b50b396 into develop Oct 4, 2023
@simon-lemay-unity simon-lemay-unity deleted the feat/utp-1.4-and-transport-mtu branch October 4, 2023 15:45
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.

3 participants