sources/network/rconsession.cpp

changeset 168
96ffd13c08a2
parent 163
5948441a1951
child 169
febc3ed5435c
child 179
7fc34735178e
--- a/sources/network/rconsession.cpp	Sat Jul 23 12:23:07 2016 +0300
+++ b/sources/network/rconsession.cpp	Sat Jul 23 12:32:23 2016 +0300
@@ -112,17 +112,18 @@
 	}
 
 	for (Datagram datagram; m_socket.read(datagram);)
-		handlePacket(datagram);
+	{
+		// Only process packets that originate from the game server.
+		if (datagram.address == m_address)
+			handlePacket(datagram.message);
+	}
 }
 
 // -------------------------------------------------------------------------------------------------
 //
-void RCONSession::handlePacket(Datagram& datagram)
+void RCONSession::handlePacket(ByteArray& message)
 {
-	if (datagram.address != m_address)
-		return;
-
-	Bytestream stream(datagram.message);
+	Bytestream stream(message);
 
 	try
 	{

mercurial