diff options
author | rubidium <rubidium@openttd.org> | 2008-12-23 09:47:42 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-23 09:47:42 +0000 |
commit | ae96ca635c9e5c22452acc0c1a473f339706fec3 (patch) | |
tree | 981c844c6183f54a4240cfa3663094d557f7b865 | |
parent | d95a485108852af1a26d01cb99ba1b93cbebe1af (diff) | |
download | openttd-ae96ca635c9e5c22452acc0c1a473f339706fec3.tar.xz |
(svn r14721) -Codechange: s/NetworkTCPSocketHandler/NetworkClientSocket/ as it's (way) more descriptive what it's used for.
-rw-r--r-- | src/network/core/tcp.cpp | 14 | ||||
-rw-r--r-- | src/network/core/tcp.h | 4 | ||||
-rw-r--r-- | src/network/network.cpp | 36 | ||||
-rw-r--r-- | src/network/network_client.cpp | 2 | ||||
-rw-r--r-- | src/network/network_client.h | 2 | ||||
-rw-r--r-- | src/network/network_data.cpp | 4 | ||||
-rw-r--r-- | src/network/network_internal.h | 16 | ||||
-rw-r--r-- | src/network/network_server.cpp | 60 | ||||
-rw-r--r-- | src/network/network_server.h | 8 |
9 files changed, 73 insertions, 73 deletions
diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp index f6cef8728..5ce7d4831 100644 --- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -18,7 +18,7 @@ #include "table/strings.h" /** Very ugly temporary hack !!! */ -void NetworkTCPSocketHandler::Initialize() +void NetworkClientSocket::Initialize() { this->sock = INVALID_SOCKET; @@ -37,7 +37,7 @@ void NetworkTCPSocketHandler::Initialize() this->command_queue = NULL; } -void NetworkTCPSocketHandler::Destroy() +void NetworkClientSocket::Destroy() { closesocket(this->sock); this->writable = false; @@ -67,7 +67,7 @@ void NetworkTCPSocketHandler::Destroy() * @return the new status * TODO: needs to be splitted when using client and server socket packets */ -NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection() +NetworkRecvStatus NetworkClientSocket::CloseConnection() { NetworkCloseClient(this); @@ -90,7 +90,7 @@ NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection() * if the OS-network-buffer is full) * @param packet the packet to send */ -void NetworkTCPSocketHandler::Send_Packet(Packet *packet) +void NetworkClientSocket::Send_Packet(Packet *packet) { Packet *p; assert(packet != NULL); @@ -116,7 +116,7 @@ void NetworkTCPSocketHandler::Send_Packet(Packet *packet) * data right now (full network-buffer, it happens ;)) * 3) sending took too long */ -bool NetworkTCPSocketHandler::Send_Packets() +bool NetworkClientSocket::Send_Packets() { ssize_t res; Packet *p; @@ -165,7 +165,7 @@ bool NetworkTCPSocketHandler::Send_Packets() * @param status the variable to store the status into * @return the received packet (or NULL when it didn't receive one) */ -Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) +Packet *NetworkClientSocket::Recv_Packet(NetworkRecvStatus *status) { ssize_t res; Packet *p; @@ -244,7 +244,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) return p; } -bool NetworkTCPSocketHandler::IsPacketQueueEmpty() +bool NetworkClientSocket::IsPacketQueueEmpty() { return this->packet_queue == NULL; } diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index f956aa105..716d219af 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -85,7 +85,7 @@ enum ClientStatus { }; /** Base socket handler for all TCP sockets */ -class NetworkTCPSocketHandler : public NetworkSocketHandler { +class NetworkClientSocket : public NetworkSocketHandler { /* TODO: rewrite into a proper class */ private: Packet *packet_queue; ///< Packets that are awaiting delivery @@ -114,7 +114,7 @@ public: inline NetworkClientInfo *GetInfo() const { extern NetworkClientInfo _network_client_info[MAX_CLIENT_INFO]; - extern NetworkTCPSocketHandler _clients[MAX_CLIENTS]; + extern NetworkClientSocket _clients[MAX_CLIENTS]; return &_network_client_info[this - _clients]; } }; diff --git a/src/network/network.cpp b/src/network/network.cpp index 4e2f467f5..fb1c70ee9 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -85,7 +85,7 @@ extern NetworkUDPSocketHandler *_udp_master_socket; ///< udp master socket // Here we keep track of the clients // (and the client uses [0] for his own communication) -NetworkTCPSocketHandler _clients[MAX_CLIENTS]; +NetworkClientSocket _clients[MAX_CLIENTS]; @@ -146,11 +146,11 @@ NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip) /** * Return the client state given it's client-identifier * @param client_id the ClientID to search for - * @return return a pointer to the corresponding NetworkTCPSocketHandler struct or NULL when not found + * @return return a pointer to the corresponding NetworkClientSocket struct or NULL when not found */ -NetworkTCPSocketHandler *NetworkFindClientStateFromClientID(ClientID client_id) +NetworkClientSocket *NetworkFindClientStateFromClientID(ClientID client_id) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { if (cs->client_id == client_id) return cs; @@ -161,7 +161,7 @@ NetworkTCPSocketHandler *NetworkFindClientStateFromClientID(ClientID client_id) // NetworkGetClientName is a server-safe function to get the name of the client // if the user did not send it yet, Client #<no> is used. -void NetworkGetClientName(char *client_name, size_t size, const NetworkTCPSocketHandler *cs) +void NetworkGetClientName(char *client_name, size_t size, const NetworkClientSocket *cs) { const NetworkClientInfo *ci = cs->GetInfo(); @@ -256,7 +256,7 @@ void CDECL NetworkTextMessage(NetworkAction action, ConsoleColour color, bool se } // Calculate the frame-lag of a client -uint NetworkCalculateLag(const NetworkTCPSocketHandler *cs) +uint NetworkCalculateLag(const NetworkClientSocket *cs) { int lag = cs->last_frame_server - cs->last_frame; // This client has missed his ACK packet after 1 DAY_TICKS.. @@ -290,7 +290,7 @@ static void ServerStartError(const char *error) NetworkError(STR_NETWORK_ERR_SERVER_START); } -static void NetworkClientError(NetworkRecvStatus res, NetworkTCPSocketHandler* cs) +static void NetworkClientError(NetworkRecvStatus res, NetworkClientSocket* cs) { // First, send a CLIENT_ERROR to the server, so he knows we are // disconnection (and why!) @@ -417,9 +417,9 @@ void ParseConnectionString(const char **company, const char **port, char *connec // Creates a new client from a socket // Used both by the server and the client -static NetworkTCPSocketHandler *NetworkAllocClient(SOCKET s) +static NetworkClientSocket *NetworkAllocClient(SOCKET s) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; byte client_no = 0; if (_network_server) { @@ -453,7 +453,7 @@ static NetworkTCPSocketHandler *NetworkAllocClient(SOCKET s) } // Close a connection -void NetworkCloseClient(NetworkTCPSocketHandler *cs) +void NetworkCloseClient(NetworkClientSocket *cs) { NetworkClientInfo *ci; // Socket is already dead @@ -469,7 +469,7 @@ void NetworkCloseClient(NetworkTCPSocketHandler *cs) NetworkErrorCode errorno = NETWORK_ERROR_CONNECTION_LOST; char str[100]; char client_name[NETWORK_CLIENT_NAME_LENGTH]; - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; NetworkGetClientName(client_name, sizeof(client_name), cs); @@ -559,7 +559,7 @@ static bool NetworkConnect(const char *hostname, int port) static void NetworkAcceptClients() { struct sockaddr_in sin; - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; uint i; bool banned; @@ -667,7 +667,7 @@ static bool NetworkListen() // Close all current connections static void NetworkClose() { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { if (!_network_server) { @@ -702,7 +702,7 @@ static void NetworkClose() // Inits the network (cleans sockets and stuff) static void NetworkInitialize() { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; _local_command_queue = NULL; @@ -890,7 +890,7 @@ bool NetworkServerStart() void NetworkReboot() { if (_network_server) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { SEND_COMMAND(PACKET_SERVER_NEWGAME)(cs); cs->Send_Packets(); @@ -904,7 +904,7 @@ void NetworkReboot() void NetworkDisconnect() { if (_network_server) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { SEND_COMMAND(PACKET_SERVER_SHUTDOWN)(cs); cs->Send_Packets(); @@ -921,7 +921,7 @@ void NetworkDisconnect() // Receives something from the network static bool NetworkReceive() { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; int n; fd_set read_fd, write_fd; struct timeval tv; @@ -976,7 +976,7 @@ static bool NetworkReceive() // This sends all buffered commands (if possible) static void NetworkSend() { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { if (cs->writable) { cs->Send_Packets(); diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index d6cd1af43..4b9f9b99e 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -901,7 +901,7 @@ void NetworkClient_Connected() } // Reads the packets from the socket-stream, if available -NetworkRecvStatus NetworkClient_ReadPackets(NetworkTCPSocketHandler *cs) +NetworkRecvStatus NetworkClient_ReadPackets(NetworkClientSocket *cs) { Packet *p; NetworkRecvStatus res = NETWORK_RECV_STATUS_OKAY; diff --git a/src/network/network_client.h b/src/network/network_client.h index 11dd26b93..f2f920728 100644 --- a/src/network/network_client.h +++ b/src/network/network_client.h @@ -19,7 +19,7 @@ DEF_CLIENT_SEND_COMMAND_PARAM(PACKET_CLIENT_SET_NAME)(const char *name); DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_ACK); DEF_CLIENT_SEND_COMMAND_PARAM(PACKET_CLIENT_RCON)(const char *pass, const char *command); -NetworkRecvStatus NetworkClient_ReadPackets(NetworkTCPSocketHandler *cs); +NetworkRecvStatus NetworkClient_ReadPackets(NetworkClientSocket *cs); void NetworkClient_Connected(); #endif /* ENABLE_NETWORK */ diff --git a/src/network/network_data.cpp b/src/network/network_data.cpp index d45f78683..7570ed527 100644 --- a/src/network/network_data.cpp +++ b/src/network/network_data.cpp @@ -16,7 +16,7 @@ #include "../company_func.h" // Add a command to the local command queue -void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp) +void NetworkAddCommandQueue(NetworkClientSocket *cs, CommandPacket *cp) { CommandPacket* new_cp = MallocT<CommandPacket>(1); @@ -79,7 +79,7 @@ void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, Comma /* Only the local client (in this case, the server) gets the callback */ c.callback = 0; /* And we queue it for delivery to the clients */ - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { if (cs->status > STATUS_MAP_WAIT) NetworkAddCommandQueue(cs, &c); } diff --git a/src/network/network_internal.h b/src/network/network_internal.h index 93bffd01b..f7098c1f6 100644 --- a/src/network/network_internal.h +++ b/src/network/network_internal.h @@ -125,7 +125,7 @@ extern CommandPacket *_local_command_queue; // Here we keep track of the clients // (and the client uses [0] for his own communication) -extern NetworkTCPSocketHandler _clients[MAX_CLIENTS]; +extern NetworkClientSocket _clients[MAX_CLIENTS]; void NetworkTCPQueryServer(const char* host, unsigned short port); @@ -136,15 +136,15 @@ void UpdateNetworkGameWindow(bool unselect); bool IsNetworkCompatibleVersion(const char *version); void NetworkExecuteCommand(CommandPacket *cp); -void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp); +void NetworkAddCommandQueue(NetworkClientSocket *cs, CommandPacket *cp); // from network.c -void NetworkCloseClient(NetworkTCPSocketHandler *cs); +void NetworkCloseClient(NetworkClientSocket *cs); void CDECL NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_send, const char *name, const char *str, ...); -void NetworkGetClientName(char *clientname, size_t size, const NetworkTCPSocketHandler *cs); -uint NetworkCalculateLag(const NetworkTCPSocketHandler *cs); +void NetworkGetClientName(char *clientname, size_t size, const NetworkClientSocket *cs); +uint NetworkCalculateLag(const NetworkClientSocket *cs); byte NetworkGetCurrentLanguageIndex(); -NetworkTCPSocketHandler *NetworkFindClientStateFromClientID(ClientID client_id); +NetworkClientSocket *NetworkFindClientStateFromClientID(ClientID client_id); char* GetNetworkErrorMsg(char* buf, NetworkErrorCode err, const char* last); bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]); @@ -154,8 +154,8 @@ bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]); #define DEF_CLIENT_RECEIVE_COMMAND(type) NetworkRecvStatus NetworkPacketReceive_ ## type ## _command(Packet *p) #define DEF_CLIENT_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command() #define DEF_CLIENT_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command -#define DEF_SERVER_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(NetworkTCPSocketHandler *cs, Packet *p) -#define DEF_SERVER_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command(NetworkTCPSocketHandler *cs) +#define DEF_SERVER_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(NetworkClientSocket *cs, Packet *p) +#define DEF_SERVER_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command(NetworkClientSocket *cs) #define DEF_SERVER_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command #define SEND_COMMAND(type) NetworkPacketSend_ ## type ## _command diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 717823126..8af01e4c9 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -33,14 +33,14 @@ // This file handles all the server-commands -static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs); +static void NetworkHandleCommandQueue(NetworkClientSocket* cs); // ********** // Sending functions -// DEF_SERVER_SEND_COMMAND has parameter: NetworkTCPSocketHandler *cs +// DEF_SERVER_SEND_COMMAND has parameter: NetworkClientSocket *cs // ********** -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CLIENT_INFO)(NetworkTCPSocketHandler *cs, NetworkClientInfo *ci) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CLIENT_INFO)(NetworkClientSocket *cs, NetworkClientInfo *ci) { // // Packet: SERVER_CLIENT_INFO @@ -75,7 +75,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO) /* Make a list of all clients per company */ char clients[MAX_COMPANIES][NETWORK_CLIENTS_LENGTH]; - NetworkTCPSocketHandler *csi; + NetworkClientSocket *csi; memset(clients, 0, sizeof(clients)); /* Add the local player (if not dedicated) */ @@ -128,7 +128,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO) cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkTCPSocketHandler *cs, NetworkErrorCode error) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientSocket *cs, NetworkErrorCode error) { // // Packet: SERVER_ERROR @@ -147,7 +147,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkTCPSocketHandler *cs, // Only send when the current client was in game if (cs->status > STATUS_AUTH) { - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; char client_name[NETWORK_CLIENT_NAME_LENGTH]; NetworkGetClientName(client_name, sizeof(client_name), cs); @@ -179,7 +179,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkTCPSocketHandler *cs, NetworkCloseClient(cs); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHECK_NEWGRFS)(NetworkTCPSocketHandler *cs) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHECK_NEWGRFS)(NetworkClientSocket *cs) { // // Packet: PACKET_SERVER_CHECK_NEWGRFS @@ -207,7 +207,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHECK_NEWGRFS)(NetworkTCPSocketHandl cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_NEED_PASSWORD)(NetworkTCPSocketHandler *cs, NetworkPasswordType type) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_NEED_PASSWORD)(NetworkClientSocket *cs, NetworkPasswordType type) { // // Packet: SERVER_NEED_PASSWORD @@ -238,7 +238,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WELCOME) // Packet *p; - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; // Invalid packet when status is AUTH or higher if (cs->status >= STATUS_AUTH) return; @@ -271,7 +271,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WAIT) // uint8: Clients awaiting map // int waiting = 0; - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; Packet *p; // Count how many clients are waiting in the queue @@ -363,7 +363,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP) fclose(file_pointer); { - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; bool new_map_client = false; // Check if there is a client waiting for receiving the map // and start sending him the map @@ -400,7 +400,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP) } } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_JOIN)(NetworkTCPSocketHandler *cs, ClientID client_id) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_JOIN)(NetworkClientSocket *cs, ClientID client_id) { // // Packet: SERVER_JOIN @@ -466,7 +466,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_SYNC) cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_COMMAND)(NetworkTCPSocketHandler *cs, CommandPacket *cp) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_COMMAND)(NetworkClientSocket *cs, CommandPacket *cp) { // // Packet: SERVER_COMMAND @@ -497,7 +497,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_COMMAND)(NetworkTCPSocketHandler *cs cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHAT)(NetworkTCPSocketHandler *cs, NetworkAction action, ClientID client_id, bool self_send, const char *msg) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHAT)(NetworkClientSocket *cs, NetworkAction action, ClientID client_id, bool self_send, const char *msg) { // // Packet: SERVER_CHAT @@ -518,7 +518,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHAT)(NetworkTCPSocketHandler *cs, N cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkTCPSocketHandler *cs, ClientID client_id, NetworkErrorCode errorno) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkClientSocket *cs, ClientID client_id, NetworkErrorCode errorno) { // // Packet: SERVER_ERROR_QUIT @@ -537,7 +537,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkTCPSocketHandler cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_QUIT)(NetworkTCPSocketHandler *cs, ClientID client_id, const char *leavemsg) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_QUIT)(NetworkClientSocket *cs, ClientID client_id, const char *leavemsg) { // // Packet: SERVER_ERROR_QUIT @@ -582,7 +582,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NEWGAME) cs->Send_Packet(p); } -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkTCPSocketHandler *cs, uint16 color, const char *command) +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientSocket *cs, uint16 color, const char *command) { Packet *p = NetworkSend_Init(PACKET_SERVER_RCON); @@ -593,7 +593,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkTCPSocketHandler *cs, u // ********** // Receiving functions -// DEF_SERVER_RECEIVE_COMMAND has parameter: NetworkTCPSocketHandler *cs, Packet *p +// DEF_SERVER_RECEIVE_COMMAND has parameter: NetworkClientSocket *cs, Packet *p // ********** DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_INFO) @@ -749,7 +749,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_PASSWORD) DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_GETMAP) { - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; // The client was never joined.. so this is impossible, right? // Ignore the packet, give the client a warning, and close his connection @@ -777,7 +777,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_MAP_OK) // Client has the map, now start syncing if (cs->status == STATUS_DONE_MAP && !cs->has_quit) { char client_name[NETWORK_CLIENT_NAME_LENGTH]; - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; NetworkGetClientName(client_name, sizeof(client_name), cs); @@ -847,7 +847,7 @@ static bool CheckCommandFlags(const CommandPacket *cp, const NetworkClientInfo * */ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) { - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; const NetworkClientInfo *ci; byte callback; @@ -954,7 +954,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_ERROR) { // This packets means a client noticed an error and is reporting this // to us. Display the error and report it to the other clients - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; char str[100]; char client_name[NETWORK_CLIENT_NAME_LENGTH]; NetworkErrorCode errorno = (NetworkErrorCode)p->Recv_uint8(); @@ -986,7 +986,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_QUIT) { // The client wants to leave. Display this and report it to the other // clients. - NetworkTCPSocketHandler *new_cs; + NetworkClientSocket *new_cs; char str[100]; char client_name[NETWORK_CLIENT_NAME_LENGTH]; @@ -1050,7 +1050,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_ACK) void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, const char *msg, ClientID from_id) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; const NetworkClientInfo *ci, *ci_own, *ci_to; switch (desttype) { @@ -1246,7 +1246,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_RCON) } // The layout for the receive-functions by the server -typedef void NetworkServerPacket(NetworkTCPSocketHandler *cs, Packet *p); +typedef void NetworkServerPacket(NetworkClientSocket *cs, Packet *p); // This array matches PacketType. At an incoming @@ -1335,7 +1335,7 @@ void NetworkPopulateCompanyStats(NetworkCompanyStats *stats) // Send a packet to all clients with updated info about this client_id void NetworkUpdateClientInfo(ClientID client_id) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id); if (ci == NULL) return; @@ -1450,7 +1450,7 @@ bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]) } // Reads a packet from the stream -bool NetworkServer_ReadPackets(NetworkTCPSocketHandler *cs) +bool NetworkServer_ReadPackets(NetworkClientSocket *cs) { Packet *p; NetworkRecvStatus res; @@ -1468,7 +1468,7 @@ bool NetworkServer_ReadPackets(NetworkTCPSocketHandler *cs) } // Handle the local command-queue -static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs) +static void NetworkHandleCommandQueue(NetworkClientSocket* cs) { CommandPacket *cp; @@ -1483,7 +1483,7 @@ static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs) // This is called every tick if this is a _network_server void NetworkServer_Tick(bool send_frame) { - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; #ifndef ENABLE_NETWORK_SYNC_EVERY_FRAME bool send_sync = false; #endif @@ -1603,7 +1603,7 @@ void NetworkServerShowStatusToConsole() "active" }; - NetworkTCPSocketHandler *cs; + NetworkClientSocket *cs; FOR_ALL_CLIENT_SOCKETS(cs) { int lag = NetworkCalculateLag(cs); const NetworkClientInfo *ci = cs->GetInfo(); diff --git a/src/network/network_server.h b/src/network/network_server.h index 620fed36b..593579aaa 100644 --- a/src/network/network_server.h +++ b/src/network/network_server.h @@ -8,13 +8,13 @@ #ifdef ENABLE_NETWORK DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP); -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkTCPSocketHandler *cs, ClientID client_id, NetworkErrorCode errorno); -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkTCPSocketHandler *cs, NetworkErrorCode error); +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkClientSocket *cs, ClientID client_id, NetworkErrorCode errorno); +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientSocket *cs, NetworkErrorCode error); DEF_SERVER_SEND_COMMAND(PACKET_SERVER_SHUTDOWN); DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NEWGAME); -DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkTCPSocketHandler *cs, uint16 color, const char *command); +DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientSocket *cs, uint16 color, const char *command); -bool NetworkServer_ReadPackets(NetworkTCPSocketHandler *cs); +bool NetworkServer_ReadPackets(NetworkClientSocket *cs); void NetworkServer_Tick(bool send_frame); #else /* ENABLE_NETWORK */ |