diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index f7c0830b1a..0c5e1a547f 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -30,7 +30,7 @@ enum SendPacketsState : uint8_t { /** Base socket handler for all TCP sockets */ class NetworkTCPSocketHandler : public NetworkSocketHandler { private: - std::deque> packet_queue; ///< Packets that are awaiting delivery. Cannot be std::queue as that does not have a clear() function. + std::deque> packet_queue{}; ///< Packets that are awaiting delivery. Cannot be std::queue as that does not have a clear() function. std::unique_ptr packet_recv = nullptr; ///< Partially received packet void EmptyPacketQueue(); diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h index 74dca6128f..c6d8bf5f38 100644 --- a/src/network/core/tcp_admin.h +++ b/src/network/core/tcp_admin.h @@ -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); diff --git a/src/network/network_admin.h b/src/network/network_admin.h index b6193bede9..7028849deb 100644 --- a/src/network/network_admin.h +++ b/src/network/network_admin.h @@ -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 { private: - std::unique_ptr authentication_handler; ///< The handler for the authentication. + std::unique_ptr 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 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(); diff --git a/src/network/network_base.h b/src/network/network_base.h index 3fd5de124f..9d1ebe8597 100644 --- a/src/network/network_base.h +++ b/src/network/network_base.h @@ -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. diff --git a/src/network/network_server.h b/src/network/network_server.h index 6826cbad55..cd5c48e0e9 100644 --- a/src/network/network_server.h +++ b/src/network/network_server.h @@ -24,7 +24,7 @@ extern NetworkClientSocketPool _networkclientsocket_pool; class ServerNetworkGameSocketHandler : public NetworkClientSocketPool::PoolItem<&_networkclientsocket_pool>, public NetworkGameSocketHandler, public TCPListenHandler { protected: std::unique_ptr 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 savegame = nullptr; ///< Writer used to write the savegame.