From 5c566411e17087207cbbde74e093b91eecfe0193 Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Tue, 3 Feb 2009 10:56:22 +0000 Subject: [PATCH] Close out fire from queue list as this is not necessarily needed to keep games in sync; While processing the noloss queue, only process 5 packets max --- CHANGELOG.txt | 4 ++++ main/network.c | 2 +- main/noloss.c | 9 +++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 06450222c..f4c44817d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20090203 +-------- +main/network.c, main/noloss.c: Close out fire from queue list as this is not necessarily needed to keep games in sync; While processing the noloss queue, only process 5 packets max + 20090202 -------- main/newdemo.c: Defined some default cockpit modes in Demo mode so we do not get invalid values when demo starts in non-default-view mode (as new HUD modes are only triggered at beginning and end of event) diff --git a/main/network.c b/main/network.c index 7e5774c30..d850825d1 100644 --- a/main/network.c +++ b/main/network.c @@ -3292,7 +3292,7 @@ void network_do_frame(int force, int listen) // Send out packet 10 times per second maximum... unless they fire, then send more often... if ( (last_send_time > (F1_0 / Network_pps)) || (Network_laser_fired) || force || PacketUrgent ) { - int to_queue = (Network_laser_fired || force || PacketUrgent); + int to_queue = (force || PacketUrgent); if ( Players[Player_num].connected ) { int objnum = Players[Player_num].objnum; diff --git a/main/noloss.c b/main/noloss.c index c2a290f00..443494204 100644 --- a/main/noloss.c +++ b/main/noloss.c @@ -27,7 +27,7 @@ void noloss_add_packet_to_queue(int urgent, int pkt_num, char *data, ushort data // Only add urgent packets if (!urgent) return; - + for (i = 0; i < NOLOSS_QUEUE_SIZE; i++) { if (noloss_queue[i].used) @@ -165,7 +165,7 @@ void noloss_init_queue(void) // 2) Check if there are packets in queue which we need to re-send to player(s) (if packet is older than one second) void noloss_process_queue(void) { - int i; + int i, count = 0; for (i = 0; i < NOLOSS_QUEUE_SIZE; i++) { @@ -204,6 +204,11 @@ void noloss_process_queue(void) { con_printf(CON_DEBUG, "Re-Sending queued packet %i\n",i); noloss_send_queued_packet(i); + count++; } + + // Only send 5 packets from the queue by each time the queue process is called + if (count >= 5) + break; } }