Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Transport pipeline is wasting sending queue!

Discussion in 'NetCode for ECS' started by BobFlame, Mar 24, 2021.

  1. BobFlame

    BobFlame

    Joined:
    Nov 12, 2018
    Posts:
    95
    This transport library have driven me mad for a long time. And finally I spent a lot of time to figure out, what is payloadSize, sendingQueueSize, why sending data return -5 or -4.

    The INetworkInterface(typically BaselibNetworkInterface) use sendingQueue * payloadSize to create a buffer, when some code call BeginSend, it create a slice from buffer with size = payloadSize, So maximum BeginSend appending should be queueSize.

    Here for the fragmente stage. It also need a payloadSize parameter, which is the max data size the stage accept, typically 32 * MTU.

    Here comes the funny thing. When you call Driver.EndSend, internally it use a NetworkPipelineProcessor Sending method. It iterate over all stages of the pipeline, for a single fragments stage, it call Driver.Send(without pipeline) 32 times! So your queue will be used 32 times faster.

    And you can't set INetworkInterface.payloadSize = MTU and Fragments.payloadSize = 32 * MTU, it's not allowed. It has to be 32 * MTU.

    The modification of package is beyond my capability and time. So could anyone give a solution to me?