/* vim: set filetype=c ts=8 noexpandtab: */ #define RELIABILITY_PRINT #ifdef RELIABILITY_PRINT #define dprintf(X,...) printf(X,__VA_ARGS__) #else #define dprintf(X,...) #endif #include "common.h" #include "bitstream.h" #include "rakpeer.h" #include "reliability.h" #include /** seems like a nop */ static void UpdateThreadedMemory(struct CReliabilityLayer *this) { if (this->freeThreadedMemoryOnNextUpdate) { this->freeThreadedMemoryOnNextUpdate = 0; } } static void AddBitsReceivedStatistic(struct CReliabilityLayer *this, int bits) { unsigned int loValue; loValue = this->statistics_bitsReceivedLo32; this->statistics_bitsReceivedLo32 += bits; if (this->statistics_bitsReceivedLo32 < loValue) { this->statistics_bitsReceivedHi32++; } } int __stdcall ReliabilityLayer__HandleSocketReceiveFromConnectedPlayer( struct CReliabilityLayer *this, char *buffer, int length, struct PlayerID playerId, void *messageHandlerList, int MTUSize, int *ptrOutIsPacketFlood) { struct CBitStream bitStream; struct CRaknetTimeNS time; struct CRangeList incomingAcks; char hasAcks; if (length == 1 || buffer == NULL) { dprintf("ignoring length %d buffer %p\n", length, buffer); // connection request, ignore return 1; } UpdateThreadedMemory(this); AddBitsReceivedStatistic(this, length * 8); BitStream__ctor(&bitStream, buffer, length, 0); RakNet__GetTimeNS(&time); __RangeList__ctor(&incomingAcks); BitStream__Read(&bitStream, &hasAcks); if (hasAcks) { dprintf("hasacks\n"); } __RangeList__dtor(&incomingAcks); BitStream__dtor(&bitStream); return 0; }