<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39639 >

 Attribute chunk packet has constant size data block. If there is not
that much usable data, delta code has been working with somewhat
random data. This has caused extra traffic at least.
 Attached patch fills unused portion of data block with 0.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/packets.c freeciv/common/packets.c
--- freeciv/common/packets.c	2007-08-11 12:17:15.000000000 +0300
+++ freeciv/common/packets.c	2007-08-30 23:09:42.000000000 +0300
@@ -646,6 +646,12 @@
 	   packet.chunk_length);
     bytes_left -= packet.chunk_length;
 
+    if (packet.chunk_length < ATTRIBUTE_CHUNK_SIZE) {
+      /* Last chunk is not full. Make sure that delta does
+       * not use random data. */
+      memset(packet.data, 0, ATTRIBUTE_CHUNK_SIZE - packet.chunk_length);
+    }
+
     send_packet_player_attribute_chunk(pconn, &packet);
   }
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to