mirror of
https://github.com/monero-project/monero.git
synced 2026-07-28 14:47:15 -07:00
Merge pull request #10842
fa91ae4common: remove dead code (Thomas)8701fc9blockchain_db: remove unused MDB_val_copy specializations (Thomas)00d21eeepee: remove dead code (Thomas) ACKs: selsta, jpk68
This commit is contained in:
@@ -100,7 +100,6 @@ class connection_basic_pimpl; // PIMPL for this class
|
||||
e_connection_type_P2P = 2 // to other p2p node (probably limited)
|
||||
};
|
||||
|
||||
std::string to_string(t_connection_type type);
|
||||
|
||||
class connection_basic { // not-templated base class for rapid development of some code parts
|
||||
// beware of removing const, net_utils::connection is sketchily doing a cast to prevent storing ptr twice
|
||||
@@ -169,8 +168,6 @@ class connection_basic { // not-templated base class for rapid development of so
|
||||
}
|
||||
|
||||
// various handlers to be called from connection class:
|
||||
void do_send_handler_write(const void * ptr , size_t cb);
|
||||
void do_send_handler_write_from_queue(const boost::system::error_code& e, size_t cb , int q_len); // from handle_write, sending next part
|
||||
|
||||
void logger_handle_net_write(size_t size); // network data written
|
||||
void logger_handle_net_read(size_t size); // network data read
|
||||
@@ -187,7 +184,6 @@ class connection_basic { // not-templated base class for rapid development of so
|
||||
static int get_tos_flag();
|
||||
|
||||
// handlers and sleep
|
||||
void sleep_before_packet(size_t packet_size, int phase, int q_len); // execute a sleep ; phase is not really used now(?)
|
||||
static double get_sleep_time(size_t cb);
|
||||
};
|
||||
|
||||
|
||||
@@ -43,20 +43,6 @@ namespace epee
|
||||
class byte_slice;
|
||||
namespace levin
|
||||
{
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct bucket_head
|
||||
{
|
||||
uint64_t m_signature;
|
||||
uint64_t m_cb;
|
||||
uint8_t m_have_to_return_data;
|
||||
uint32_t m_command;
|
||||
int32_t m_return_code;
|
||||
uint32_t m_reservedA; //probably some flags in future
|
||||
uint32_t m_reservedB; //probably some check sum in future
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
@@ -83,7 +69,6 @@ constexpr const std::chrono::milliseconds LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED{0}
|
||||
#define LEVIN_PACKET_END 0x00000008
|
||||
|
||||
|
||||
#define LEVIN_PROTOCOL_VER_0 0
|
||||
#define LEVIN_PROTOCOL_VER_1 1
|
||||
|
||||
|
||||
|
||||
@@ -471,18 +471,14 @@ inline MAKE_LOGGABLE(connection_context_base, ct, os)
|
||||
#define LOG_INFO_CC(ct, message) MINFO(ct << message)
|
||||
#define LOG_DEBUG_CC(ct, message) MDEBUG(ct << message)
|
||||
#define LOG_TRACE_CC(ct, message) MTRACE(ct << message)
|
||||
#define LOG_CC(level, ct, message) MLOG(level, ct << message)
|
||||
|
||||
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0(ct << message)
|
||||
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1(ct << message)
|
||||
#define LOG_PRINT_CC_L2(ct, message) LOG_PRINT_L2(ct << message)
|
||||
#define LOG_PRINT_CC_L3(ct, message) LOG_PRINT_L3(ct << message)
|
||||
#define LOG_PRINT_CC_L4(ct, message) LOG_PRINT_L4(ct << message)
|
||||
|
||||
#define LOG_PRINT_CCONTEXT_L0(message) LOG_PRINT_CC_L0(context, message)
|
||||
#define LOG_PRINT_CCONTEXT_L1(message) LOG_PRINT_CC_L1(context, message)
|
||||
#define LOG_PRINT_CCONTEXT_L2(message) LOG_PRINT_CC_L2(context, message)
|
||||
#define LOG_PRINT_CCONTEXT_L3(message) LOG_PRINT_CC_L3(context, message)
|
||||
#define LOG_ERROR_CCONTEXT(message) LOG_ERROR_CC(context, message)
|
||||
|
||||
#define CHECK_AND_ASSERT_MES_CC(condition, return_val, err_message) CHECK_AND_ASSERT_MES(condition, return_val, "[" << epee::net_utils::print_connection_context_short(context) << "]" << err_message)
|
||||
|
||||
@@ -74,7 +74,6 @@ namespace net_utils
|
||||
typedef double network_speed_kbps; // externally, for parameters and return values, all defined in kilobytes per second
|
||||
typedef double network_speed_bps; // throttle-internally, bytes per second
|
||||
typedef double network_time_seconds;
|
||||
typedef double network_MB;
|
||||
|
||||
class i_network_throttle;
|
||||
|
||||
|
||||
@@ -53,19 +53,12 @@ namespace epee
|
||||
#define PROFILE_FUNC_THIRD(immortal_ptr_str)
|
||||
#endif
|
||||
|
||||
#define START_WAY_POINTS() uint64_t _____way_point_time = epee::misc_utils::get_tick_count();
|
||||
#define WAY_POINT(name) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; MDEBUG("Way point " << name << ": " << delta);_____way_point_time = misc_utils::get_tick_count();}
|
||||
#define WAY_POINT2(name, avrg_obj) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; avrg_obj.push(delta); MDEBUG("Way point " << name << ": " << delta);_____way_point_time = misc_utils::get_tick_count();}
|
||||
|
||||
|
||||
#define TIME_MEASURE_START(var_name) uint64_t var_name = epee::misc_utils::get_tick_count();
|
||||
#define TIME_MEASURE_PAUSE(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
|
||||
#define TIME_MEASURE_RESTART(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
|
||||
#define TIME_MEASURE_FINISH(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
|
||||
|
||||
#define TIME_MEASURE_NS_START(var_name) uint64_t var_name = epee::misc_utils::get_ns_count();
|
||||
#define TIME_MEASURE_NS_PAUSE(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
|
||||
#define TIME_MEASURE_NS_RESTART(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
|
||||
#define TIME_MEASURE_NS_FINISH(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
|
||||
|
||||
namespace profile_tools
|
||||
|
||||
@@ -160,7 +160,6 @@ namespace epee
|
||||
|
||||
typedef boost::variant<uint64_t, uint32_t, uint16_t, uint8_t, int64_t, int32_t, int16_t, int8_t, double, bool, std::string, section, array_entry> storage_entry;
|
||||
|
||||
typedef std::string binarybuffer;//it's ok
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
|
||||
@@ -83,8 +83,6 @@ namespace epee
|
||||
void read(section& sec);
|
||||
void read(std::string& str);
|
||||
void read(array_entry &ae);
|
||||
template<class t_type>
|
||||
size_t min_bytes() const;
|
||||
void set_limits(size_t objects, size_t fields, size_t strings);
|
||||
private:
|
||||
struct recursuion_limitation_guard
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -106,36 +106,6 @@ private:
|
||||
T t_copy;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MDB_val_copy<cryptonote::blobdata>: public MDB_val
|
||||
{
|
||||
MDB_val_copy(const cryptonote::blobdata &bd) :
|
||||
data(new char[bd.size()])
|
||||
{
|
||||
memcpy(data.get(), bd.data(), bd.size());
|
||||
mv_size = bd.size();
|
||||
mv_data = data.get();
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<char[]> data;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MDB_val_copy<const char*>: public MDB_val
|
||||
{
|
||||
MDB_val_copy(const char *s):
|
||||
size(strlen(s)+1), // include the NUL, makes it easier for compares
|
||||
data(new char[size])
|
||||
{
|
||||
mv_size = size;
|
||||
mv_data = data.get();
|
||||
memcpy(mv_data, s, size);
|
||||
}
|
||||
private:
|
||||
size_t size;
|
||||
std::unique_ptr<char[]> data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace cryptonote
|
||||
|
||||
@@ -219,19 +219,6 @@ namespace command_line
|
||||
description.add_options()(arg.name, boost::program_options::bool_switch(), arg.description);
|
||||
}
|
||||
|
||||
template<typename charT>
|
||||
boost::program_options::basic_parsed_options<charT> parse_command_line(int argc, const charT* const argv[],
|
||||
const boost::program_options::options_description& desc, bool allow_unregistered = false)
|
||||
{
|
||||
auto parser = boost::program_options::command_line_parser(argc, argv);
|
||||
parser.options(desc);
|
||||
if (allow_unregistered)
|
||||
{
|
||||
parser.allow_unregistered();
|
||||
}
|
||||
return parser.run();
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
bool handle_error_helper(const boost::program_options::options_description& desc, F parser)
|
||||
{
|
||||
|
||||
@@ -274,20 +274,6 @@ namespace tools
|
||||
return control;
|
||||
}
|
||||
|
||||
bool download_finished(const download_async_handle &control)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(control != 0, false, "NULL async download handle");
|
||||
boost::lock_guard<boost::mutex> lock(control->mutex);
|
||||
return control->stopped;
|
||||
}
|
||||
|
||||
bool download_error(const download_async_handle &control)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(control != 0, false, "NULL async download handle");
|
||||
boost::lock_guard<boost::mutex> lock(control->mutex);
|
||||
return !control->success;
|
||||
}
|
||||
|
||||
bool download_wait(const download_async_handle &control)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(control != 0, false, "NULL async download handle");
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace tools
|
||||
|
||||
bool download(const std::string &path, const std::string &url, std::function<bool(const std::string&, const std::string&, size_t, ssize_t)> progress = NULL);
|
||||
download_async_handle download_async(const std::string &path, const std::string &url, std::function<void(const std::string&, const std::string&, bool)> result, std::function<bool(const std::string&, const std::string&, size_t, ssize_t)> progress = NULL);
|
||||
bool download_error(const download_async_handle &h);
|
||||
bool download_finished(const download_async_handle &h);
|
||||
bool download_wait(const download_async_handle &h);
|
||||
bool download_cancel(const download_async_handle &h);
|
||||
}
|
||||
|
||||
@@ -97,17 +97,6 @@ el::Level performance_timer_log_level = el::Level::Info;
|
||||
static thread_local std::vector<LoggingPerformanceTimer*> *performance_timers = NULL;
|
||||
#endif
|
||||
|
||||
void set_performance_timer_log_level(el::Level level)
|
||||
{
|
||||
if (level != el::Level::Debug && level != el::Level::Trace && level != el::Level::Info
|
||||
&& level != el::Level::Warning && level != el::Level::Error && level != el::Level::Fatal)
|
||||
{
|
||||
MERROR("Wrong log level: " << el::LevelHelper::convertToString(level) << ", using Info");
|
||||
level = el::Level::Info;
|
||||
}
|
||||
performance_timer_log_level = level;
|
||||
}
|
||||
|
||||
PerformanceTimer::PerformanceTimer(bool paused): started(true), paused(paused)
|
||||
{
|
||||
if (paused)
|
||||
|
||||
@@ -75,8 +75,6 @@ private:
|
||||
el::Level level;
|
||||
};
|
||||
|
||||
void set_performance_timer_log_level(el::Level level);
|
||||
|
||||
#define PERF_TIMER_NAME(name) pt_##name
|
||||
#define PERF_TIMER_UNIT(name, unit) tools::LoggingPerformanceTimer PERF_TIMER_NAME(name)(#name, "perf." MONERO_DEFAULT_LOG_CATEGORY, unit, tools::performance_timer_log_level)
|
||||
#define PERF_TIMER_UNIT_L(name, unit, l) tools::LoggingPerformanceTimer PERF_TIMER_NAME(name)t_##name(#name, "perf." MONERO_DEFAULT_LOG_CATEGORY, unit, l)
|
||||
|
||||
Reference in New Issue
Block a user