29 #include "../../idlib/precompiled.h"
51 #define MAX_PACKETLEN 1400 // max size of a network packet
52 #define FRAGMENT_SIZE (MAX_PACKETLEN - 100)
53 #define FRAGMENT_BIT (1<<31)
220 for (
int i = 0;
i <
size;
i++ ) {
232 for (
int i = 0;
i <
size;
i++ ) {
236 for (
int i = 0;
i <
size;
i++ ) {
322 if ( deltaTime > 1000 ) {
337 tmp.
Init( tmpBuf,
sizeof( tmpBuf ) );
367 int reliableAcknowledge, reliableMessageSize, reliableSequence;
380 reliableAcknowledge = out.
ReadLong();
391 while( reliableMessageSize != 0 ) {
392 if ( reliableMessageSize <= 0 || reliableMessageSize > out.
GetSize() - out.
GetReadCount() ) {
428 msg.
Init( msgBuf,
sizeof( msgBuf ) );
479 common->
Error(
"idMsgChannel::SendMessage: called with unsent fragments left" );
486 common->
Printf(
"idMsgChannel::SendMessage: message too large, length = %i\n", totalLength );
540 int fragStart, fragLength, dropped;
548 common->
Printf(
"idMsgChannel::Process: fixing up a translated port\n" );
560 sequence &= ~FRAGMENT_BIT;
577 common->
Printf(
"%d recv %4i : s = %i fragment = %i,%i\n",
id, msg.
GetSize(), sequence, fragStart, fragLength );
679 common->
Warning(
"idMsgChannel::SendReliableMessage: overflowed" );
718 if ( deltaTime > 1000 ) {
static idCompressor * AllocRunLength_ZeroBased(void)
void WriteData(const byte *data, const int size)
virtual int Read(void *outData, int outLength)=0
int GetReadCount(void) const
void UpdateIncomingRate(const int time, const int size)
int SendMessage(idPort &port, const int time, const idBitMsg &msg)
virtual int Write(const void *inData, int inLength)=0
assert(prefInfo.fullscreenBtn)
void ReadData(byte *data, const int size)
bool Process(const netadr_t from, int time, idBitMsg &msg, int &sequence)
virtual float GetCompressionRatio(void) const =0
GLenum GLenum GLenum GLenum GLenum scale
float outgoingCompression
int GetRemaingData(void) const
byte unsentBuffer[MAX_MESSAGE_SIZE]
int incomingPacketLossTime
bool SendReliableMessage(const idBitMsg &msg)
void Init(const netadr_t adr, const int id)
idCompressor * compressor
byte fragmentBuffer[MAX_MESSAGE_SIZE]
void SendNextFragment(idPort &port, const int time)
idMsgQueue reliableReceive
void Init(byte *data, int length)
int ReadData(void *data, int length) const
virtual void Init(idFile *f, bool compress, int wordLength)=0
void WriteData(const void *data, int length)
byte buffer[MAX_MSG_QUEUE_SIZE]
idCVar net_channelShowPackets("net_channelShowPackets","0", CVAR_SYSTEM|CVAR_BOOL,"show all packets")
void SendPacket(const netadr_t to, const void *data, int size)
void CopyToBuffer(byte *buf) const
float incomingDroppedPackets
int GetTotalSize(void) const
bool GetReliableMessage(idBitMsg &msg)
idCVar net_channelShowDrop("net_channelShowDrop","0", CVAR_SYSTEM|CVAR_BOOL,"show dropped packets")
void BeginReading(void) const
bool Get(byte *data, int &size)
GLsizei GLsizei GLenum GLenum const GLvoid * data
void ClearReliableMessages(void)
bool ReadyToSend(const int time) const
float incomingCompression
virtual void Printf(const char *fmt,...) id_attribute((format(printf
virtual void FinishCompress(void)=0
const char * Sys_NetAdrToString(const netadr_t a)
void UpdatePacketLoss(const int time, const int numReceived, const int numDropped)
float incomingReceivedPackets
bool ReadMessageData(idBitMsg &out, const idBitMsg &msg)
float GetIncomingPacketLoss(void) const
bool Add(const byte *data, const int size)
virtual void Error(const char *fmt,...) id_attribute((format(printf
int GetSpaceLeft(void) const
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
void UpdateOutgoingRate(const int time, const int size)
#define MAX_MSG_QUEUE_SIZE
void WriteMessageData(idBitMsg &out, const idBitMsg &msg)
int ReadShort(void) const