17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 03:59:19 +02:00

refactor: sonar c++20 changes (#185)

This commit is contained in:
jerrrrycho
2026-09-28 21:08:15 +02:00
committed by GitHub
parent 4137f5504a
commit 176427f96b
18 changed files with 111 additions and 106 deletions

View File

@@ -12,8 +12,10 @@ network::tcp::connection::connection(asio::io_context &io_ctx, bool client, size
network::tcp::connection::~connection()
{
m_socket.shutdown(m_socket.shutdown_both);
m_socket.close();
// error_code overloads: the throwing ones would escape the destructor, e.g. when the peer is already gone
asio::error_code ec;
m_socket.shutdown(m_socket.shutdown_both, ec);
m_socket.close(ec);
}
void network::tcp::connection::disconnect()

View File

@@ -30,17 +30,17 @@ struct client_hello : public message
virtual void serialize(std::ostream &stream) const override;
virtual void deserialize(std::istream &stream) override;
int32_t version;
uint32_t start_packet;
int32_t version{};
uint32_t start_packet{};
};
struct server_hello : public message
{
server_hello() : message(SERVER_HELLO) {}
uint32_t seed;
int64_t timestamp;
int64_t config;
uint32_t seed{};
int64_t timestamp{};
int64_t config{};
std::string scenario;
virtual void serialize(std::ostream &stream) const override;
@@ -62,9 +62,9 @@ struct frame_info : public request_command
{
frame_info() : request_command(FRAME_INFO) {}
double render_dt;
double dt;
double sync;
double render_dt{};
double dt{};
double sync{};
virtual void serialize(std::ostream &stream) const override;
virtual void deserialize(std::istream &stream) override;