mirror of
https://github.com/monero-project/monero.git
synced 2026-07-28 14:47:15 -07:00
epee: remove dead code
Each symbol below has no references anywhere in the tree (src/, contrib/, tests/); the full build still links cleanly. Per-symbol history is given so the "why is this unused" is auditable (hashes are ancestors of HEAD). net/connection_basic (all four lost their last caller in the 2022 connection rewrite,3be1dbd09"connection: fix implementation"): - to_string(t_connection_type): unused free function. Added9bfa593ee(2015) to print a connection's type in a debug log;3be1dbd09(2022) switched that log line to std::to_string on the enum, orphaning this overload. - do_send_handler_write / do_send_handler_write_from_queue: trace-only stubs addedeabb51960(2015) on the TCP send path; their calls in do_send_chunk / the write-completion handler were deleted by3be1dbd09(2022). The real send path is connection<T>::start_write(). - sleep_before_packet: outbound rate-limit sleep addedeabb51960(2015); callers were thinned over time (cf5f62361, 2017) and the last removed by3be1dbd09(2022). Rate-limiting now lives in connection<T>::start_write() via the global out-throttle. net/levin_base: - struct bucket_head: legacy levin packet header from the 2014 epee import, superseded by bucket_head2 (the wire header, `using header = bucket_head2`). Its last use went away with the old levin_protocol_handler in0c545f614(2024, "epee/test: remove levin_protocol_handler and core_proxy tests"). - LEVIN_PROTOCOL_VER_0: dead on arrival - present since the 2014 import, never referenced (the code uses LEVIN_PROTOCOL_VER_1). net/net_utils_base (connection-context logging macros): - LOG_PRINT_CC_L4: levin trace macro (2014 import); all call sites removed in5833d66f6(2017, "Change logging to easylogging++"). - LOG_PRINT_CCONTEXT_L3: had a single "REMOTE PEERLIST" call site, removed in the same5833d66f6(2017). - LOG_PRINT_CC_L3: only ever referenced inside LOG_PRINT_CCONTEXT_L3's body, never invoked directly - transitively dead once the above was removed. - LOG_CC: dead on arrival - added in5833d66f6(2017) but never invoked. (The plain LOG_PRINT_L3 macro that LOG_PRINT_CC_L3/CCONTEXT_L3 wrap is still used elsewhere and is left untouched; only these unused CC wrappers go.) net/network_throttle: - typedef network_MB: addedeabb51960(2015); its only consumers (set_target_kill / m_target_MB) were stripped the same day in5ce4256e3(2015), leaving an unused typedef. profile_tools: - START_WAY_POINTS / WAY_POINT / WAY_POINT2: dead on arrival - upstream-epee profiling macros present since the 2014 import, never once invoked (they only ever appear as definitions in profile_tools.h across all history). - TIME_MEASURE_PAUSE / TIME_MEASURE_RESTART and their _NS_ variants: dead on arrival - addedbda8c5983(2017, "epee: add nanosecond timer and pause/restart profiling macros") but never wired to any call site. Of this family only TIME_MEASURE_START / TIME_MEASURE_FINISH are actually used. storages: - typedef binarybuffer (portable_storage_base): used by the binary store/load API since the 2014 import; its last consumer (store_to_binary) was removed in7414e2bac(2020, "Change epee binary output from std::stringstream to byte_stream"). - the templated min_bytes() member declaration (portable_storage_from_bin): declared but never defined or called. Added7f407c027(2020-12-26, "portable_storage: add some sanity checks on data size") alongside the ps_min_bytes<> trait struct, but the size checks were implemented via that trait (ps_min_bytes<>::strict), so this member was never defined or wired up - dead on arrival. The ps_min_bytes<> trait remains in use and is left intact.
This commit is contained in:
@@ -67,21 +67,6 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::string to_string(t_connection_type type)
|
||||
{
|
||||
if (type == e_connection_type_NET)
|
||||
return std::string("NET");
|
||||
else if (type == e_connection_type_RPC)
|
||||
return std::string("RPC");
|
||||
else if (type == e_connection_type_P2P)
|
||||
return std::string("P2P");
|
||||
|
||||
return std::string("UNKNOWN");
|
||||
}
|
||||
|
||||
|
||||
/* ============================================================================ */
|
||||
|
||||
class connection_basic_pimpl {
|
||||
public:
|
||||
connection_basic_pimpl(const std::string &name);
|
||||
@@ -222,46 +207,6 @@ int connection_basic::get_tos_flag() {
|
||||
return connection_basic_pimpl::m_default_tos;
|
||||
}
|
||||
|
||||
void connection_basic::sleep_before_packet(size_t packet_size, int phase, int q_len) {
|
||||
double delay=0; // will be calculated
|
||||
do
|
||||
{ // rate limiting
|
||||
if (m_was_shutdown) {
|
||||
_dbg2("m_was_shutdown - so abort sleep");
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
|
||||
delay = network_throttle_manager::get_global_throttle_out().get_sleep_time_after_tick( packet_size );
|
||||
}
|
||||
|
||||
delay *= 0.50;
|
||||
if (delay > 0) {
|
||||
long int ms = (long int)(delay * 1000);
|
||||
MTRACE("Sleeping in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<packet_size); // debug sleep
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
|
||||
}
|
||||
} while(delay > 0);
|
||||
|
||||
// XXX LATER XXX
|
||||
{
|
||||
CRITICAL_REGION_LOCAL( network_throttle_manager::m_lock_get_global_throttle_out );
|
||||
network_throttle_manager::get_global_throttle_out().handle_trafic_exact( packet_size ); // increase counter - global
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void connection_basic::do_send_handler_write(const void* ptr , size_t cb ) {
|
||||
// No sleeping here; sleeping is done once and for all in connection<t_protocol_handler>::handle_write
|
||||
MTRACE("handler_write (direct) - before ASIO write, for packet="<<cb<<" B (after sleep)");
|
||||
}
|
||||
|
||||
void connection_basic::do_send_handler_write_from_queue( const boost::system::error_code& e, size_t cb, int q_len ) {
|
||||
// No sleeping here; sleeping is done once and for all in connection<t_protocol_handler>::handle_write
|
||||
MTRACE("handler_write (after write, from queue="<<q_len<<") - before ASIO write, for packet="<<cb<<" B (after sleep)");
|
||||
}
|
||||
|
||||
void connection_basic::logger_handle_net_read(size_t size) { // network data read
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user