Git Product home page Git Product logo

Comments (25)

garrynewman avatar garrynewman commented on September 13, 2024 1

Yeah my fix did fix it for me. Here's what I changed in BuildPacketFromSplitPacketList:

    for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
    {
        splitPacket=splitPacketChannel->splitPacketList[j];
        memcpy(internalPacket->data + BITS_TO_BYTES(offset), splitPacket->data, (size_t)BITS_TO_BYTES(splitPacketChannel->splitPacketList[j]->dataBitLength));
        offset += splitPacketChannel->splitPacketList[j]->dataBitLength;
    }

to

    BitSize_t offset = 0;
    for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
    {
//
// GARRY - RETRIEVE SPLIT PACKETS IN THE PROPER ORDER
//
        splitPacket = NULL;

        for ( int a = 0; a < splitPacketChannel->splitPacketList.Size(); a++ )
        {
            if ( splitPacketChannel->splitPacketList[a]->splitPacketIndex != j )
                continue;

            splitPacket = splitPacketChannel->splitPacketList[a];
            break;
        }

        if ( splitPacket == NULL ) 
        splitPacket = splitPacketChannel->splitPacketList[j];

        memcpy( internalPacket->data + BITS_TO_BYTES( offset ), splitPacket->data, (size_t)BITS_TO_BYTES( splitPacket->dataBitLength ) );
        offset += splitPacket->dataBitLength;
//
// END GARRY
//
    }

from raknet.

garrynewman avatar garrynewman commented on September 13, 2024

I did some logging and found that the issue is only apparent when the packets are split, and when the first fragment isn't received first.

It seems to be that split packets aren't being reconstructed in the correct order, but in the order in which the packets are received. I've changed the BuildPacketFromSplitPacketList function to construct the packets in order splitPacketIndex - will report whether this fixes it.

from raknet.

larku avatar larku commented on September 13, 2024

Hi @garrynewman,

If you could contribute a patch/pull request that would be great - I'm using RakNet in an application that will often have packets > MTU so I'm very interested in any fixes here.

Regards.

from raknet.

larku avatar larku commented on September 13, 2024

Hey @garrynewman

Did you have any success with your fixes?

Note, the latest source already appears to use splitPacketIndex when reconstructing the packets:

memcpy(internalPacket->data+splitPacket->splitPacketIndex*splitPacketPartLength, splitPacket->data, (size_t) BITS_TO_BYTES(splitPacketChannel->splitPacketList[j]->dataBitLength));

Regards.

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

Having a serious issue like this and no replies from the developers doesn't exactly make RakNet look very good.

from raknet.

vrripoll avatar vrripoll commented on September 13, 2024

it, is the code of previous version, it think all split packet have the same size, it store the size into splitPacketPartLength=BITS_TO_BYTES(splitPacketChannel->firstPacket->dataBitLength);

and fill the memory with
memcpy(internalPacket->data+splitPacket->splitPacketIndex*splitPacketPartLength, splitPacket->data, (size_t) BITS_TO_BYTES(splitPacketChannel->splitPacketList[j]->dataBitLength));

and use splitPacketIndex to put the split pack in this position.

but i am not sure this code it is ok and all split packet have the same size.

----------- CODE -----------------------------
'''
InternalPacket * ReliabilityLayer::BuildPacketFromSplitPacketList( SplitPacketChannel *splitPacketChannel, CCTimeType time )
{
#if PREALLOCATE_LARGE_MESSAGES==1
InternalPacket *returnedPacket=splitPacketChannel->returnedPacket;
RakNet::OP_DELETE(splitPacketChannel, FILE, LINE);
(void) time;
return returnedPacket;
#else
unsigned int j;
InternalPacket * internalPacket, *splitPacket;
int splitPacketPartLength;
internalPacket = CreateInternalPacketCopy( splitPacketChannel->splitPacketList[0], 0, 0, time );
internalPacket->dataBitLength=0;
for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
internalPacket->dataBitLength+=splitPacketChannel->splitPacketList[j]->dataBitLength;
splitPacketPartLength=BITS_TO_BYTES(splitPacketChannel->firstPacket->dataBitLength);

internalPacket->data = (unsigned char*) rakMalloc_Ex( (size_t) BITS_TO_BYTES( internalPacket->dataBitLength ), _FILE_AND_LINE_ );
internalPacket->allocationScheme=InternalPacket::NORMAL;

for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
{
    splitPacket=splitPacketChannel->splitPacketList[j];
    memcpy(internalPacket->data+splitPacket->splitPacketIndex*splitPacketPartLength, splitPacket->data, (size_t) BITS_TO_BYTES(splitPacketChannel->splitPacketList[j]->dataBitLength));
}

for (j=0; j < splitPacketChannel->splitPacketList.Size(); j++)
{
    FreeInternalPacketData(splitPacketChannel->splitPacketList[j], _FILE_AND_LINE_ );
    ReleaseToInternalPacketPool(splitPacketChannel->splitPacketList[j]);
}
RakNet::OP_DELETE(splitPacketChannel, __FILE__, __LINE__);

return internalPacket;

#endif
}
'''

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

I might want to wrape that code with ```

from raknet.

vrripoll avatar vrripoll commented on September 13, 2024

sorry i only speak a little english

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

Put ``` at the start and end of your code.

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

That's almost right. You have to include new lines before and after it. So like

'''
Code
Code
'''

from raknet.

vrripoll avatar vrripoll commented on September 13, 2024

sorry i try it,y put ''' but it is not ok

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

It's ```, I just put ''' as an example so it didn't show as code. You still have to put a new line before your last one.

from raknet.

vrripoll avatar vrripoll commented on September 13, 2024

in the code of GARRY i dont understan how this part of the code it is possible

if ( splitPacket == NULL )
splitPacket = splitPacketChannel->splitPacketList[j];

how ist si posible not found splitPacket by splitPacketIndex

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

Packet editing? Packet corruption? Dunno.

from raknet.

vrripoll avatar vrripoll commented on September 13, 2024

i think if it not found splitPacket , it is a error and this mesage must be discard.
if use splitPacket = splitPacketChannel->splitPacketList[j]; it must be copying data in a Incorrect position

from raknet.

Mellnik avatar Mellnik commented on September 13, 2024

Can this be fixed and officially be committed on the repo? Ever since Oculus bought it there are no big updates...

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

RakNet has been abandoned, as is shown on the website.

from raknet.

biller23 avatar biller23 commented on September 13, 2024

Maybe Oculus, the new owner of RakNet, is too busy with VR to care about this project for now...

from raknet.

Mellnik avatar Mellnik commented on September 13, 2024

Fine, Oculus shall then assign someone repo admin rights so he can process pull requests.

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

I'm not really sure why they bought something to leave it die. It certainly at least needs someone to process pull requests, so we can include fixes like Garry's.

from raknet.

Brybry avatar Brybry commented on September 13, 2024

Maybe someone with the know-how will start a community fork

Thanks for the fix @garrynewman! I was beating my head against this bug for hours :(
As noted by larku, it seems e97c4bb introduced this bug.

from raknet.

larku avatar larku commented on September 13, 2024

I've got a fork ( https://github.com/larku/RakNet ) that includes most of the pending pull requests from the official if that's of use to you. I'm also happy to accept pull requests into this fork.

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

Seems the problem described in this ticket is still present in your fork.

from raknet.

larku avatar larku commented on September 13, 2024

Hey @Cleroth, that fork includes:

larku@c15dd90

Which should address this.

from raknet.

Cleroth avatar Cleroth commented on September 13, 2024

Oh... so it was fixed long ago in a different way...
Thanks. I might actually give RakNet a try now.

from raknet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.