Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Conversation

@m9co
Copy link

@m9co m9co commented Feb 17, 2021

When sending data, that exceed maximum message size, Carrier will split in into several smaller ones. Maximum message data size is defined by variable m_maxMsgDataSizeBytes, which is calculated as following:

m_maxMsgDataSizeBytes = m_maxDataGramSizeBytes - GetDataGramHeaderSize() - GetMaxMessageHeaderSize();

When data compression is enabled, in addition to datagram and message headers, carrier adds additional header with compression hint flags (added in CarrierThread::SendDatagram).
Compression header is not accounted in m_maxMsgDataSizeBytes and resulting split messages won't be sent due to following code from CarrierThread::GenerateOutgoingDataGram:

                //If this Message can fit into the remaining Datagram buffer space
                if ((msg.m_dataSize + GetMessageHeaderSize(msg, isWriteMessageSequenceId, isWriteReliableMessageSequenceId, isWriteChannel))
                        > (maxDatagramSize - writeBuffer.Size()))
                {
                    break; // we can't add this message
                }

Moreover, these messages will remain in send queue and completely block the network.
Issue happens only for messages, sent through custom network channels and not for regular game synchronization performed by replica manager. Replica manager uses channel 0, which is not included in message header, freeing up a necessary byte.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

When sending data, that exceed maximum message size, Carrier will split in into several smaller ones. Maximum message data size is defined by variable m_maxMsgDataSizeBytes, which is calculated as following:
m_maxMsgDataSizeBytes = m_maxDataGramSizeBytes - GetDataGramHeaderSize() - GetMaxMessageHeaderSize();
When data compression is enabled, in addition to datagram and message headers, carrier adds additional header with compression hint flags (added in CarrierThread::SendDatagram).
Compression header is not accounted in m_maxMsgDataSizeBytes and resulting split messages won't be sent due to following code from CarrierThread::GenerateOutgoingDataGram:
                //If this Message can fit into the remaining Datagram buffer space
                if ((msg.m_dataSize + GetMessageHeaderSize(msg, isWriteMessageSequenceId, isWriteReliableMessageSequenceId, isWriteChannel))
                        > (maxDatagramSize - writeBuffer.Size()))
                {
                    break; // we can't add this message
                }

Moreover, these messages will remain in send queue and completely block the network. 
Issue happens only for messages, sent through custom network channels and not for regular game synchronization performed by replica manager. Replica manager uses channel 0, which is not included in message header, freeing up a necessary byte.
@trng-lmbr
Copy link

Hello @m9co! We've integrated your pull request and wanted to let you know that you should be able to see your changes in our next version of the Lumberyard engine. Thank you kindly for contributing to Lumberyard!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants