summaryrefslogtreecommitdiff
path: root/src/network/network_admin.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-04-22 16:05:05 +0000
committerrubidium <rubidium@openttd.org>2011-04-22 16:05:05 +0000
commitcdfc0ec4a3cb1fc9e23cc74c405e56c736fe3272 (patch)
tree1ae2a4a93d6db73c16115078b98e56d4a2f7bb7b /src/network/network_admin.cpp
parent2cae0cd54cffde47e771e614175249ed1d75fe85 (diff)
downloadopenttd-cdfc0ec4a3cb1fc9e23cc74c405e56c736fe3272.tar.xz
(svn r22369) -Codechange: allocate ClientInfo when needed, i.e. don't allocate it for clients that are there to just get a list of companies. This means that these short lived clients won't be seen by the admin network in their client queries anymore
Diffstat (limited to 'src/network/network_admin.cpp')
-rw-r--r--src/network/network_admin.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp
index a5726093c..3bda0ae84 100644
--- a/src/network/network_admin.cpp
+++ b/src/network/network_admin.cpp
@@ -208,9 +208,12 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin(ClientID clien
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs)
{
+ /* Only send data when we're a proper client, not just someone trying to query the server. */
+ const NetworkClientInfo *ci = cs->GetInfo();
+ if (ci == NULL) return NETWORK_RECV_STATUS_OKAY;
+
Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_INFO);
- const NetworkClientInfo *ci = cs->GetInfo();
p->Send_uint32(ci->client_id);
p->Send_string(const_cast<NetworkAddress &>(cs->client_address).GetHostname());
p->Send_string(ci->client_name);