[ENet-discuss] ENet bug: in
enet_protocol_handle_send_fragment(...)
Lee Salzman
lsalzman at telerama.com
Tue Aug 12 22:47:13 PDT 2003
Sharp eyes. I can't believe I missed that. I'm almost embarrassed. :)
I committed a fix for this to CVS and included it in the main tarball.
Lee
On Wed, Aug 13, 2003 at 08:40:45AM +0900, ?????? wrote:
> Hi,
> I found an error in protocol.c' enet_protocol_handle_send_fragment()
>
> original codes are:
>
> for (currentCommand = enet_list_previous(enet_list_end(&channel->incomingReliableCommands));
> currentCommand !=enet_list_end(&channel->incomingReliableCommands);
> currentCommand = enet_list_previous(currentCommand)) {
> startCommand = (ENetIncomingCommand *) currentCommand;
> if (startCommand->reliableSequenceNumber == startSequenceNumber) {
> break;
> }
>
> The lines could not handle if the first fragment of a fragmented message is lost.
> For example, consider that an user message is fragmented into more than two fragments and
> the receiver lost the first fragment at first time and received the second fragment and then the first fragment which
> is retransmitted by the sender.
> In this case the second fragment and the first one are considered as a separate message.
> User can get no more message if this situation occurs.
>
> So, I changed the code lines as follows:
>
> for (currentCommand = enet_list_previous(enet_list_end(&channel->incomingReliableCommands));
> currentCommand !=enet_list_end(&channel->incomingReliableCommands);
> currentCommand = enet_list_previous(currentCommand)) {
> startCommand = (ENetIncomingCommand *) currentCommand;
> if (startCommand->reliableSequenceNumber == startSequenceNumber) {
> break;
> /* NEWLY ADDED LINES! to handle reversly received fragments */
> if (startCommand->reliableSequenceNumber > startSequenceNumber ) {
> ENetProtocol *anchor = (ENetProtocol *)&startCommand->command;
> /* check if the startCommand belongs to the same message */
> if (anchor->sendFragment.startSequenceNumber == startSequenceNumber)
> break;
>
> }
> }
>
> The code worked fine to me.
> Hope useful.
> PS) Sorry. I could not add diff output because I added so many debug lines in enet. ;-)
>
> ---------------
> Won
>
More information about the ENet-discuss
mailing list