aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/epee/include')
-rw-r--r--contrib/epee/include/misc_log_ex.h10
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl2
-rw-r--r--contrib/epee/include/net/net_utils_base.h10
-rw-r--r--contrib/epee/include/string_tools.h9
4 files changed, 29 insertions, 2 deletions
diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h
index 1ff9da3a7..602b6a371 100644
--- a/contrib/epee/include/misc_log_ex.h
+++ b/contrib/epee/include/misc_log_ex.h
@@ -85,6 +85,16 @@
#define MGINFO_MAGENTA(x) MCLOG_MAGENTA(el::Level::Info, "global",x)
#define MGINFO_CYAN(x) MCLOG_CYAN(el::Level::Info, "global",x)
+#define IFLOG(level, cat, type, init, x) \
+ do { \
+ if (ELPP->vRegistry()->allowed(level, cat)) { \
+ init; \
+ el::base::Writer(level, __FILE__, __LINE__, ELPP_FUNC, type).construct(cat) << x; \
+ } \
+ } while(0)
+#define MIDEBUG(init, x) IFLOG(el::Level::Debug, MONERO_DEFAULT_LOG_CATEGORY, el::base::DispatchAction::NormalLog, init, x)
+
+
#define LOG_ERROR(x) MERROR(x)
#define LOG_PRINT_L0(x) MWARNING(x)
#define LOG_PRINT_L1(x) MINFO(x)
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index d8779f372..457ee2dd4 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -295,6 +295,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
CRITICAL_REGION_LOCAL(m_throttle_speed_in_mutex);
m_throttle_speed_in.handle_trafic_exact(bytes_transferred);
context.m_current_speed_down = m_throttle_speed_in.get_current_speed();
+ context.m_max_speed_down = std::max(context.m_max_speed_down, context.m_current_speed_down);
}
{
@@ -497,6 +498,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
CRITICAL_REGION_LOCAL(m_throttle_speed_out_mutex);
m_throttle_speed_out.handle_trafic_exact(cb);
context.m_current_speed_up = m_throttle_speed_out.get_current_speed();
+ context.m_max_speed_up = std::max(context.m_max_speed_up, context.m_current_speed_up);
}
//_info("[sock " << socket_.native_handle() << "] SEND " << cb);
diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h
index a133942fb..a9e458626 100644
--- a/contrib/epee/include/net/net_utils_base.h
+++ b/contrib/epee/include/net/net_utils_base.h
@@ -228,6 +228,8 @@ namespace net_utils
uint64_t m_send_cnt;
double m_current_speed_down;
double m_current_speed_up;
+ double m_max_speed_down;
+ double m_max_speed_up;
connection_context_base(boost::uuids::uuid connection_id,
const network_address &remote_address, bool is_income,
@@ -242,7 +244,9 @@ namespace net_utils
m_recv_cnt(recv_cnt),
m_send_cnt(send_cnt),
m_current_speed_down(0),
- m_current_speed_up(0)
+ m_current_speed_up(0),
+ m_max_speed_down(0),
+ m_max_speed_up(0)
{}
connection_context_base(): m_connection_id(),
@@ -254,7 +258,9 @@ namespace net_utils
m_recv_cnt(0),
m_send_cnt(0),
m_current_speed_down(0),
- m_current_speed_up(0)
+ m_current_speed_up(0),
+ m_max_speed_down(0),
+ m_max_speed_up(0)
{}
connection_context_base& operator=(const connection_context_base& a)
diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h
index f7539fb6c..2e65876e6 100644
--- a/contrib/epee/include/string_tools.h
+++ b/contrib/epee/include/string_tools.h
@@ -206,6 +206,15 @@ POP_WARNINGS
return boost::lexical_cast<std::string>(val);
}
//----------------------------------------------------------------------------
+ inline std::string to_string_hex(uint32_t val)
+ {
+ std::stringstream ss;
+ ss << std::hex << val;
+ std::string s;
+ ss >> s;
+ return s;
+ }
+ //----------------------------------------------------------------------------
inline bool compare_no_case(const std::string& str1, const std::string& str2)
{