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

This commit is contained in:
zicodxx 2009-02-03 10:56:22 +00:00
parent 39ce196542
commit 5c566411e1
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog 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 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) 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)

View file

@ -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... // Send out packet 10 times per second maximum... unless they fire, then send more often...
if ( (last_send_time > (F1_0 / Network_pps)) || if ( (last_send_time > (F1_0 / Network_pps)) ||
(Network_laser_fired) || force || PacketUrgent ) { (Network_laser_fired) || force || PacketUrgent ) {
int to_queue = (Network_laser_fired || force || PacketUrgent); int to_queue = (force || PacketUrgent);
if ( Players[Player_num].connected ) { if ( Players[Player_num].connected ) {
int objnum = Players[Player_num].objnum; int objnum = Players[Player_num].objnum;

View file

@ -27,7 +27,7 @@ void noloss_add_packet_to_queue(int urgent, int pkt_num, char *data, ushort data
// Only add urgent packets // Only add urgent packets
if (!urgent) if (!urgent)
return; return;
for (i = 0; i < NOLOSS_QUEUE_SIZE; i++) for (i = 0; i < NOLOSS_QUEUE_SIZE; i++)
{ {
if (noloss_queue[i].used) 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) // 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) void noloss_process_queue(void)
{ {
int i; int i, count = 0;
for (i = 0; i < NOLOSS_QUEUE_SIZE; i++) 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); con_printf(CON_DEBUG, "Re-Sending queued packet %i\n",i);
noloss_send_queued_packet(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;
} }
} }