Open qtx0213 opened 7 years ago
把 ReliabilityLayer 的 BuildPacketFromSplitPacketList 改成下面这样就可以了。` InternalPacket ReliabilityLayer::BuildPacketFromSplitPacketList( SplitPacketChannel splitPacketChannel, CCTimeType time ) {
InternalPacket *returnedPacket=splitPacketChannel->returnedPacket; RakNet::OP_DELETE(splitPacketChannel, __FILE__, __LINE__); (void) time; return returnedPacket;
unsigned int j; InternalPacket * internalPacket, *splitPacket; // int splitPacketPartLength; // Reconstruct 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; BitSize_t offset = 0; int itt = 0; while (itt < splitPacketChannel->splitPacketList.Size()) { for (j = 0; j < splitPacketChannel->splitPacketList.Size(); j++) { splitPacket = splitPacketChannel->splitPacketList[j]; if (itt == splitPacket->splitPacketIndex) { memcpy(internalPacket->data + BITS_TO_BYTES(offset), splitPacket->data, (size_t)BITS_TO_BYTES(splitPacketChannel->splitPacketList[j]->dataBitLength)); offset += splitPacketChannel->splitPacketList[j]->dataBitLength; break; } } itt++; } 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;
}``
you are right
发pr吧
把 ReliabilityLayer 的 BuildPacketFromSplitPacketList 改成下面这样就可以了。` InternalPacket ReliabilityLayer::BuildPacketFromSplitPacketList( SplitPacketChannel splitPacketChannel, CCTimeType time ) {
if PREALLOCATE_LARGE_MESSAGES==1
else
endif
}``