X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=netconn.c;h=aa4d5ba155522920604990d8eb0dc00660d5ec06;hb=5908505db317767a308ba531ea732d7a6f5b211d;hp=abf8e31af82a5ef0df7e62843cf99811b65c0e72;hpb=babcd6f17eb3269f3f0ba3995a7b9713f0170246;p=xonotic%2Fdarkplaces.git diff --git a/netconn.c b/netconn.c index abf8e31a..aa4d5ba1 100755 --- a/netconn.c +++ b/netconn.c @@ -690,7 +690,7 @@ qboolean NetConn_CanSend(netconn_t *conn) } } -void NetConn_UpdateCleartime(double *cleartime, int rate, int burstsize, int len) +static void NetConn_UpdateCleartime(double *cleartime, int rate, int burstsize, int len) { double bursttime = burstsize / (double)rate; @@ -1248,6 +1248,12 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s { conn->droppedDatagrams += count; //Con_DPrintf("Dropped %u datagram(s)\n", count); + // If too may packets have been dropped, only write the + // last NETGRAPH_PACKETS ones to the netgraph. Why? + // Because there's no point in writing more than + // these as the netgraph is going to be full anyway. + if (count > NETGRAPH_PACKETS) + count = NETGRAPH_PACKETS; while (count--) { conn->incoming_packetcounter = (conn->incoming_packetcounter + 1) % NETGRAPH_PACKETS; @@ -1338,6 +1344,12 @@ static int NetConn_ReceivedMessage(netconn_t *conn, const unsigned char *data, s count = sequence - conn->nq.unreliableReceiveSequence; conn->droppedDatagrams += count; //Con_DPrintf("Dropped %u datagram(s)\n", count); + // If too may packets have been dropped, only write the + // last NETGRAPH_PACKETS ones to the netgraph. Why? + // Because there's no point in writing more than + // these as the netgraph is going to be full anyway. + if (count > NETGRAPH_PACKETS) + count = NETGRAPH_PACKETS; while (count--) { conn->incoming_packetcounter = (conn->incoming_packetcounter + 1) % NETGRAPH_PACKETS;