about summary refs log tree commit diff
path: root/src/engine/network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/network.cpp')
-rw-r--r--src/engine/network.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/engine/network.cpp b/src/engine/network.cpp
index e95022f9..2313010e 100644
--- a/src/engine/network.cpp
+++ b/src/engine/network.cpp
@@ -510,18 +510,32 @@ int net_server_recv(NETSERVER *s, NETPACKET *packet)
 			// ok packet, process it
 			if(data.flags == NETWORK_PACKETFLAG_CONNECT)
 			{
-				// client that wants to connect
 				int found = 0;
+				
+				// check if we already got this client
 				for(int i = 0; i < NETWORK_MAX_CLIENTS; i++)
 				{
-					if(s->slots[i].conn.state == NETWORK_CONNSTATE_OFFLINE)
+					if(net_addr4_cmp(&s->slots[i].conn.peeraddr, &addr) == 0)
 					{
-						conn_feed(&s->slots[i].conn, &data, &addr);
-						found = 1;
+						found = 1; // silent ignore.. we got this client already
 						break;
 					}
 				}
 				
+				// client that wants to connect
+				if(!found)
+				{
+					for(int i = 0; i < NETWORK_MAX_CLIENTS; i++)
+					{
+						if(s->slots[i].conn.state == NETWORK_CONNSTATE_OFFLINE)
+						{
+							conn_feed(&s->slots[i].conn, &data, &addr);
+							found = 1;
+							break;
+						}
+					}
+				}
+				
 				if(!found)
 				{
 					// TODO: send error