mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-31 18:09:04 +01:00
refactor(sonar): rename locals that shadow outer declarations (cpp:S1117)
Only local variables and definition parameters are renamed; shadowing struct fields and enumerators in headers are left for a separate change.
This commit is contained in:
@@ -183,17 +183,17 @@ void network::tcp::client::connect()
|
||||
if (this->conn)
|
||||
return;
|
||||
|
||||
auto conn = std::make_shared<connection>(io_ctx, true, resume_frame_counter);
|
||||
conn->set_handler(std::bind(&client::handle_message, this, conn, std::placeholders::_1));
|
||||
auto newconnection = std::make_shared<connection>(io_ctx, true, resume_frame_counter);
|
||||
newconnection->set_handler(std::bind(&client::handle_message, this, newconnection, std::placeholders::_1));
|
||||
|
||||
asio::ip::tcp::endpoint endpoint(
|
||||
asio::ip::make_address(host), static_cast<asio::ip::port_type>(port));
|
||||
conn->m_socket.open(endpoint.protocol());
|
||||
conn->m_socket.set_option(asio::ip::tcp::no_delay(true));
|
||||
conn->m_socket.async_connect(endpoint,
|
||||
newconnection->m_socket.open(endpoint.protocol());
|
||||
newconnection->m_socket.set_option(asio::ip::tcp::no_delay(true));
|
||||
newconnection->m_socket.async_connect(endpoint,
|
||||
std::bind(&client::handle_accept, this, std::placeholders::_1));
|
||||
|
||||
this->conn = conn;
|
||||
this->conn = newconnection;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ void network::request_command::deserialize(std::istream &stream)
|
||||
uint32_t sequence_size = sn_utils::ld_uint32(stream);
|
||||
|
||||
command_queue::commanddata_sequence sequence;
|
||||
for (uint32_t i = 0; i < sequence_size; i++)
|
||||
for (uint32_t j = 0; j < sequence_size; j++)
|
||||
{
|
||||
command_data data;
|
||||
data.command = (user_command)sn_utils::ld_uint32(stream);
|
||||
|
||||
@@ -232,17 +232,17 @@ void network::client::send_commands(command_queue::commands_map commands) const
|
||||
conn->send_message(msg);
|
||||
}
|
||||
|
||||
void network::client::handle_message(std::shared_ptr<connection> conn, const message &msg)
|
||||
void network::client::handle_message(std::shared_ptr<connection> Connection, const message &msg)
|
||||
{
|
||||
if (msg.type >= message::TYPE_MAX)
|
||||
{
|
||||
conn->disconnect();
|
||||
Connection->disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.type == message::SERVER_HELLO) {
|
||||
const auto& cmd = dynamic_cast<const server_hello&>(msg);
|
||||
conn->state = connection::ACTIVE;
|
||||
Connection->state = connection::ACTIVE;
|
||||
|
||||
if (!Global.ready_to_load) {
|
||||
Global.random_seed = cmd.seed;
|
||||
@@ -253,14 +253,14 @@ void network::client::handle_message(std::shared_ptr<connection> conn, const mes
|
||||
Global.ready_to_load = true;
|
||||
} else if (Global.random_seed != cmd.seed) {
|
||||
ErrorLog("net: seed mismatch", logtype::net);
|
||||
conn->disconnect();
|
||||
Connection->disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
WriteLog("net: accept received", logtype::net);
|
||||
}
|
||||
|
||||
if (conn->state != connection::ACTIVE)
|
||||
if (Connection->state != connection::ACTIVE)
|
||||
return;
|
||||
|
||||
if (msg.type == message::FRAME_INFO) {
|
||||
|
||||
Reference in New Issue
Block a user