summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-04-22 16:03:13 +0000
committerrubidium <rubidium@openttd.org>2011-04-22 16:03:13 +0000
commit146d532d51d9304ab96138d4b4c701744b77dba5 (patch)
tree6d3913d7d10c07ed655ecd783a21c77e72859e83
parentc61abe0019e8763c406f5694e1e6ca21dc663152 (diff)
downloadopenttd-146d532d51d9304ab96138d4b4c701744b77dba5.tar.xz
(svn r22367) -Codechange: send ClientSockets instead of ClientInfos to the admin "core" as they send IP addresses to the admin "bots"
-rw-r--r--src/network/network_admin.cpp19
-rw-r--r--src/network/network_admin.h4
-rw-r--r--src/network/network_server.cpp2
3 files changed, 13 insertions, 12 deletions
diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp
index 721773c5d..9fa244f21 100644
--- a/src/network/network_admin.cpp
+++ b/src/network/network_admin.cpp
@@ -206,10 +206,11 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin(ClientID clien
return NETWORK_RECV_STATUS_OKAY;
}
-NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientInfo *ci)
+NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs)
{
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 &>(ci->client_address).GetHostname());
p->Send_string(ci->client_name);
@@ -570,14 +571,14 @@ DEF_ADMIN_RECEIVE_COMMAND(Server, ADMIN_PACKET_ADMIN_POLL)
case ADMIN_UPDATE_CLIENT_INFO:
/* The admin is requesting client info. */
- const NetworkClientInfo *ci;
+ const NetworkClientSocket *cs;
if (d1 == UINT32_MAX) {
- FOR_ALL_CLIENT_INFOS(ci) {
- this->SendClientInfo(ci);
+ FOR_ALL_CLIENT_SOCKETS(cs) {
+ this->SendClientInfo(cs);
}
} else {
- ci = NetworkClientInfo::GetByClientID((ClientID)d1);
- if (ci != NULL) this->SendClientInfo(ci);
+ cs = NetworkClientSocket::GetByClientID((ClientID)d1);
+ if (cs != NULL) this->SendClientInfo(cs);
}
break;
@@ -654,14 +655,14 @@ DEF_ADMIN_RECEIVE_COMMAND(Server, ADMIN_PACKET_ADMIN_CHAT)
* @param ci the client info.
* @param new_client if this is a new client, send the respective packet too.
*/
-void NetworkAdminClientInfo(const NetworkClientInfo *ci, bool new_client)
+void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client)
{
ServerNetworkAdminSocketHandler *as;
FOR_ALL_ADMIN_SOCKETS(as) {
if (as->update_frequency[ADMIN_UPDATE_CLIENT_INFO] & ADMIN_FREQUENCY_AUTOMATIC) {
- as->SendClientInfo(ci);
+ as->SendClientInfo(cs);
if (new_client) {
- as->SendClientJoin(ci->client_id);
+ as->SendClientJoin(cs->client_id);
}
}
}
diff --git a/src/network/network_admin.h b/src/network/network_admin.h
index 874aaf787..4ca2ef2c7 100644
--- a/src/network/network_admin.h
+++ b/src/network/network_admin.h
@@ -50,7 +50,7 @@ public:
NetworkRecvStatus SendDate();
NetworkRecvStatus SendClientJoin(ClientID client_id);
- NetworkRecvStatus SendClientInfo(const NetworkClientInfo *ci);
+ NetworkRecvStatus SendClientInfo(const NetworkClientSocket *cs);
NetworkRecvStatus SendClientUpdate(const NetworkClientInfo *ci);
NetworkRecvStatus SendClientQuit(ClientID client_id);
NetworkRecvStatus SendClientError(ClientID client_id, NetworkErrorCode error);
@@ -85,7 +85,7 @@ public:
#define FOR_ALL_ADMIN_SOCKETS_FROM(var, start) FOR_ALL_ITEMS_FROM(ServerNetworkAdminSocketHandler, adminsocket_index, var, start)
#define FOR_ALL_ADMIN_SOCKETS(var) FOR_ALL_ADMIN_SOCKETS_FROM(var, 0)
-void NetworkAdminClientInfo(const NetworkClientInfo *ci, bool new_client = false);
+void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client = false);
void NetworkAdminClientUpdate(const NetworkClientInfo *ci);
void NetworkAdminClientQuit(ClientID client_id);
void NetworkAdminClientError(ClientID client_id, NetworkErrorCode error_code);
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 9a9e05fa8..f8f966e76 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -979,7 +979,7 @@ DEF_GAME_RECEIVE_COMMAND(Server, PACKET_CLIENT_MAP_OK)
}
}
- NetworkAdminClientInfo(this->GetInfo(), true);
+ NetworkAdminClientInfo(this, true);
/* also update the new client with our max values */
this->SendConfigUpdate();