# HG changeset patch
# User Teemu Piippo <teemu@compsta2.com>
# Date 1469266543 -10800
# Node ID 40d8d7231a363b412b19739d2b270a4517e19893
# Parent  febc3ed5435c1d2791e5d48c1b05f0911c398c69
Reduce delta between branches

diff -r febc3ed5435c -r 40d8d7231a36 sources/network/rconsession.cpp
--- a/sources/network/rconsession.cpp	Sat Jul 23 12:34:05 2016 +0300
+++ b/sources/network/rconsession.cpp	Sat Jul 23 12:35:43 2016 +0300
@@ -121,29 +121,29 @@
 	// Check for new packets in our socket
 	for (Datagram datagram; m_socket.read(datagram);)
 	{
-		// Packet came from the wrong address, ignore
-		if (datagram.address != m_address)
-			continue;
-
-		// Parse and cut off the header.
-		PacketHeader header;
+		// Only process packets that originate from the game server.
+		if (datagram.address == m_address)
 		{
-			// Read the header, and find the sequence number
-			Bytestream stream(datagram.message);
-			header.header = stream.readLong();
-			header.sequenceNumber = (header.header != 0) ? stream.readLong() : -1;
-			datagram.message = datagram.message.splice(stream.position(), datagram.message.size());
-		}
+			// Parse and cut off the header.
+			PacketHeader header;
+			{
+				// Read the header, and find the sequence number
+				Bytestream stream(datagram.message);
+				header.header = stream.readLong();
+				header.sequenceNumber = (header.header != 0) ? stream.readLong() : -1;
+				datagram.message = datagram.message.splice(stream.position(), datagram.message.size());
+			}
 
-		// Try to store this packet into the queue. However, do not try to store packets without a sequence number.
-		bool stored = false;
+			// Try to store this packet into the queue. However, do not try to store packets without a sequence number.
+			bool stored = false;
 
-		if (header.sequenceNumber != -1)
-			stored = m_packetQueue.addPacket(header.sequenceNumber, datagram.message);
+			if (header.sequenceNumber != -1)
+				stored = m_packetQueue.addPacket(header.sequenceNumber, datagram.message);
 
-		// If the packet was not stored, we are to just process it right away.
-		if (stored == false)
-			handlePacket(datagram.message);
+			// If the packet was not stored, we are to just process it right away.
+			if (stored == false)
+				handlePacket(datagram.message);
+		}
 	}
 
 	// Check if we can now also process some packets from the queue.