[MAINT] Refax for CSndBuffer::readData to make the call form clearer #2593
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the form of
CSndBuffer::readData
version with offset (intended for retransmission).The problem with the existing solution was that the
CPacket
object passed there was used instrumentally to return the information about the sequence number range and message number for dropping. This didn't make any sense because the rule was that if a message retransmission was requested, but the message was qualified as to be dropped instead, theCPacket
object wasn't in use at all. But then, when returning -1 as per drop request, theCPacket
object was reused to return the message number of the message to be dropped that was written into its MSGNO field, which normally contains the message number AND the flags, but this time it was instrumentally used to just return the message number itself only. Simultaneously themsglen
was returned because it was the only way to define the sequence range, while the first sequence from the range was set to the packet.There has remained only the rule that the
CPacket
object is first set the message sequence number, and passingCPacket
to the call ofreadData
brings in this sequence information. But in case when the call resulted in a drop request, for which there was also defined a specified constant, the drop information is returned exclusively in the dedicated structure, which should be the only information for constructing theUMSG_DROPREQ
message contents - theCPacket
object is not in use in this case at all, even though it shares some partial information (the beginning sequence number).There should be no change in the behavior, just the code was made more logically clear.