mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-29 18:53:14 +00:00
Merge pull request #7310
76fe73b
Revert 'fix accessing an network address in a deleted context' (selsta)
This commit is contained in:
commit
8c8197463f
2 changed files with 9 additions and 15 deletions
|
@ -2840,15 +2840,12 @@ skip:
|
||||||
epee::string_tools::to_string_hex(context.m_pruning_seed) <<
|
epee::string_tools::to_string_hex(context.m_pruning_seed) <<
|
||||||
"), score " << score << ", flush_all_spans " << flush_all_spans);
|
"), score " << score << ", flush_all_spans " << flush_all_spans);
|
||||||
|
|
||||||
|
if (score > 0)
|
||||||
|
m_p2p->add_host_fail(context.m_remote_address, score);
|
||||||
|
|
||||||
m_block_queue.flush_spans(context.m_connection_id, flush_all_spans);
|
m_block_queue.flush_spans(context.m_connection_id, flush_all_spans);
|
||||||
|
|
||||||
// copy since dropping the connection will invalidate the context, and thus the address
|
|
||||||
const auto remote_address = context.m_remote_address;
|
|
||||||
|
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
|
|
||||||
if (score > 0)
|
|
||||||
m_p2p->add_host_fail(remote_address, score);
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------
|
||||||
template<class t_core>
|
template<class t_core>
|
||||||
|
|
|
@ -1203,9 +1203,8 @@ namespace nodetool
|
||||||
if(!handle_remote_peerlist(rsp.local_peerlist_new, context))
|
if(!handle_remote_peerlist(rsp.local_peerlist_new, context))
|
||||||
{
|
{
|
||||||
LOG_WARNING_CC(context, "COMMAND_TIMED_SYNC: failed to handle_remote_peerlist(...), closing connection.");
|
LOG_WARNING_CC(context, "COMMAND_TIMED_SYNC: failed to handle_remote_peerlist(...), closing connection.");
|
||||||
const auto remote_address = context.m_remote_address;
|
|
||||||
m_network_zones.at(context.m_remote_address.get_zone()).m_net_server.get_config_object().close(context.m_connection_id );
|
m_network_zones.at(context.m_remote_address.get_zone()).m_net_server.get_config_object().close(context.m_connection_id );
|
||||||
add_host_fail(remote_address);
|
add_host_fail(context.m_remote_address);
|
||||||
}
|
}
|
||||||
if(!context.m_is_income)
|
if(!context.m_is_income)
|
||||||
m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(context.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port, context.m_rpc_credits_per_hash);
|
m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(context.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port, context.m_rpc_credits_per_hash);
|
||||||
|
@ -1369,7 +1368,7 @@ namespace nodetool
|
||||||
if(just_take_peerlist)
|
if(just_take_peerlist)
|
||||||
{
|
{
|
||||||
zone.m_net_server.get_config_object().close(con->m_connection_id);
|
zone.m_net_server.get_config_object().close(con->m_connection_id);
|
||||||
MDEBUG(na.str() << "CONNECTION HANDSHAKED OK AND CLOSED.");
|
LOG_DEBUG_CC(*con, "CONNECTION HANDSHAKED OK AND CLOSED.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1431,7 +1430,7 @@ namespace nodetool
|
||||||
|
|
||||||
zone.m_net_server.get_config_object().close(con->m_connection_id);
|
zone.m_net_server.get_config_object().close(con->m_connection_id);
|
||||||
|
|
||||||
MDEBUG(na.str() << "CONNECTION HANDSHAKED OK AND CLOSED.");
|
LOG_DEBUG_CC(*con, "CONNECTION HANDSHAKED OK AND CLOSED.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2458,14 +2457,12 @@ namespace nodetool
|
||||||
template<class t_payload_net_handler>
|
template<class t_payload_net_handler>
|
||||||
int node_server<t_payload_net_handler>::handle_handshake(int command, typename COMMAND_HANDSHAKE::request& arg, typename COMMAND_HANDSHAKE::response& rsp, p2p_connection_context& context)
|
int node_server<t_payload_net_handler>::handle_handshake(int command, typename COMMAND_HANDSHAKE::request& arg, typename COMMAND_HANDSHAKE::response& rsp, p2p_connection_context& context)
|
||||||
{
|
{
|
||||||
// copy since dropping the connection will invalidate the context, and thus the address
|
|
||||||
const auto remote_address = context.m_remote_address;
|
|
||||||
|
|
||||||
if(arg.node_data.network_id != m_network_id)
|
if(arg.node_data.network_id != m_network_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
LOG_INFO_CC(context, "WRONG NETWORK AGENT CONNECTED! id=" << arg.node_data.network_id);
|
LOG_INFO_CC(context, "WRONG NETWORK AGENT CONNECTED! id=" << arg.node_data.network_id);
|
||||||
drop_connection(context);
|
drop_connection(context);
|
||||||
add_host_fail(remote_address);
|
add_host_fail(context.m_remote_address);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2473,7 +2470,7 @@ namespace nodetool
|
||||||
{
|
{
|
||||||
LOG_WARNING_CC(context, "COMMAND_HANDSHAKE came not from incoming connection");
|
LOG_WARNING_CC(context, "COMMAND_HANDSHAKE came not from incoming connection");
|
||||||
drop_connection(context);
|
drop_connection(context);
|
||||||
add_host_fail(remote_address);
|
add_host_fail(context.m_remote_address);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue