1
0
Fork 0

Codechange: explicitly initialise network pool item related member variables

pull/13626/head
Rubidium 2025-02-18 21:21:29 +01:00 committed by rubidium42
parent f89924a727
commit d0ba6ed1f4
5 changed files with 14 additions and 14 deletions

View File

@ -30,7 +30,7 @@ enum SendPacketsState : uint8_t {
/** Base socket handler for all TCP sockets */
class NetworkTCPSocketHandler : public NetworkSocketHandler {
private:
std::deque<std::unique_ptr<Packet>> packet_queue; ///< Packets that are awaiting delivery. Cannot be std::queue as that does not have a clear() function.
std::deque<std::unique_ptr<Packet>> packet_queue{}; ///< Packets that are awaiting delivery. Cannot be std::queue as that does not have a clear() function.
std::unique_ptr<Packet> packet_recv = nullptr; ///< Partially received packet
void EmptyPacketQueue();

View File

@ -116,8 +116,8 @@ enum AdminCompanyRemoveReason : uint8_t {
/** Main socket handler for admin related connections. */
class NetworkAdminSocketHandler : public NetworkTCPSocketHandler {
protected:
std::string admin_name; ///< Name of the admin.
std::string admin_version; ///< Version string of the admin.
std::string admin_name{}; ///< Name of the admin.
std::string admin_version{}; ///< Version string of the admin.
AdminStatus status = ADMIN_STATUS_INACTIVE; ///< Status of this admin.
NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type);

View File

@ -24,7 +24,7 @@ extern NetworkAdminSocketPool _networkadminsocket_pool;
/** Class for handling the server side of the game connection. */
class ServerNetworkAdminSocketHandler : public NetworkAdminSocketPool::PoolItem<&_networkadminsocket_pool>, public NetworkAdminSocketHandler, public TCPListenHandler<ServerNetworkAdminSocketHandler, ADMIN_PACKET_SERVER_FULL, ADMIN_PACKET_SERVER_BANNED> {
private:
std::unique_ptr<NetworkAuthenticationServerHandler> authentication_handler; ///< The handler for the authentication.
std::unique_ptr<NetworkAuthenticationServerHandler> authentication_handler = nullptr; ///< The handler for the authentication.
protected:
NetworkRecvStatus Receive_ADMIN_JOIN(Packet &p) override;
NetworkRecvStatus Receive_ADMIN_QUIT(Packet &p) override;
@ -43,9 +43,9 @@ protected:
NetworkRecvStatus SendAuthRequest();
NetworkRecvStatus SendEnableEncryption();
public:
AdminUpdateFrequency update_frequency[ADMIN_UPDATE_END]; ///< Admin requested update intervals.
std::chrono::steady_clock::time_point connect_time; ///< Time of connection.
NetworkAddress address; ///< Address of the admin.
std::array<AdminUpdateFrequency, ADMIN_UPDATE_END> update_frequency{}; ///< Admin requested update intervals.
std::chrono::steady_clock::time_point connect_time{}; ///< Time of connection.
NetworkAddress address{}; ///< Address of the admin.
ServerNetworkAdminSocketHandler(SOCKET s);
~ServerNetworkAdminSocketHandler();

View File

@ -22,11 +22,11 @@ extern NetworkClientInfoPool _networkclientinfo_pool;
/** Container for all information known about a client. */
struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_pool> {
ClientID client_id; ///< Client identifier (same as ClientState->client_id)
std::string client_name; ///< Name of the client
std::string public_key; ///< The public key of the client.
CompanyID client_playas; ///< As which company is this client playing (CompanyID)
TimerGameEconomy::Date join_date; ///< Gamedate the client has joined
ClientID client_id = INVALID_CLIENT_ID; ///< Client identifier (same as ClientState->client_id)
std::string client_name{}; ///< Name of the client
std::string public_key{}; ///< The public key of the client.
CompanyID client_playas = CompanyID::Invalid(); ///< As which company is this client playing (CompanyID)
TimerGameEconomy::Date join_date{}; ///< Gamedate the client has joined
/**
* Create a new client.

View File

@ -24,7 +24,7 @@ extern NetworkClientSocketPool _networkclientsocket_pool;
class ServerNetworkGameSocketHandler : public NetworkClientSocketPool::PoolItem<&_networkclientsocket_pool>, public NetworkGameSocketHandler, public TCPListenHandler<ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED> {
protected:
std::unique_ptr<class NetworkAuthenticationServerHandler> authentication_handler = nullptr; ///< The handler for the authentication.
std::string peer_public_key; ///< The public key of our client.
std::string peer_public_key{}; ///< The public key of our client.
NetworkRecvStatus Receive_CLIENT_JOIN(Packet &p) override;
NetworkRecvStatus Receive_CLIENT_IDENTIFY(Packet &p) override;
@ -68,7 +68,7 @@ public:
uint8_t last_token = 0; ///< The last random token we did send to verify the client is listening
uint32_t last_token_frame = 0; ///< The last frame we received the right token
ClientStatus status = STATUS_INACTIVE; ///< Status of this client
CommandQueue outgoing_queue; ///< The command-queue awaiting delivery; conceptually more a bucket to gather commands in, after which the whole bucket is sent to the client.
CommandQueue outgoing_queue{}; ///< The command-queue awaiting delivery; conceptually more a bucket to gather commands in, after which the whole bucket is sent to the client.
size_t receive_limit = 0; ///< Amount of bytes that we can receive at this moment
std::shared_ptr<struct PacketWriter> savegame = nullptr; ///< Writer used to write the savegame.