Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature

Sat, 23 Jul 2016 12:32:23 +0300

author
Teemu Piippo <teemu@compsta2.com>
date
Sat, 23 Jul 2016 12:32:23 +0300
changeset 168
96ffd13c08a2
parent 164
e3794f48a589
child 169
febc3ed5435c
child 173
248fba6d1e76

Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature

sources/network/rconsession.cpp file | annotate | diff | comparison | revisions
sources/network/rconsession.h file | annotate | diff | comparison | revisions
--- 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
 	{
--- a/sources/network/rconsession.h	Sat Jul 23 12:23:07 2016 +0300
+++ b/sources/network/rconsession.h	Sat Jul 23 12:32:23 2016 +0300
@@ -103,7 +103,7 @@
 	const String&               getLevel() const;
 	UDPSocket*                  getSocket();
 	RCONSessionState            getState() const;
-	void                        handlePacket(Datagram& datagram);
+	void                        handlePacket(ByteArray& message);
 	bool                        isActive() const;
 	void                        processServerUpdates(Bytestream& packet);
 	void                        requestTabCompletion(const String& part);

mercurial