remerged; commands JSON. logging upgrade. doxygen

This commit is contained in:
rfree2monero 2015-04-01 19:00:45 +02:00
parent 3cbdf198f1
commit c511abf005
29 changed files with 701 additions and 242 deletions

View file

@ -46,6 +46,8 @@ namespace cryptonote
struct connection_info
{
bool incoming;
bool localhost;
bool local_ip;
std::string ip;
std::string port;
@ -62,8 +64,16 @@ namespace cryptonote
uint64_t live_time;
uint64_t avg_download;
uint64_t current_download;
uint64_t avg_upload;
uint64_t current_upload;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(incoming)
KV_SERIALIZE(localhost)
KV_SERIALIZE(local_ip)
KV_SERIALIZE(ip)
KV_SERIALIZE(port)
KV_SERIALIZE(peer_id)
@ -73,6 +83,10 @@ namespace cryptonote
KV_SERIALIZE(send_idle_time)
KV_SERIALIZE(state)
KV_SERIALIZE(live_time)
KV_SERIALIZE(avg_download)
KV_SERIALIZE(current_download)
KV_SERIALIZE(avg_upload)
KV_SERIALIZE(current_upload)
END_KV_SERIALIZE_MAP()
};

View file

@ -210,6 +210,42 @@ namespace cryptonote
cnx.live_time = timestamp - cntxt.m_started;
uint32_t ip;
ip = ntohl(cntxt.m_remote_ip);
if (ip == LOCALHOST_INT)
{
cnx.localhost = true;
}
else
{
cnx.localhost = false;
}
if (ip > 3232235520 && ip < 3232301055) // 192.168.x.x
{
cnx.local_ip = true;
}
else
{
cnx.local_ip = false;
}
auto connection_time = time(NULL) - cntxt.m_started;
if (connection_time == 0)
{
cnx.avg_download = 0;
cnx.avg_upload = 0;
}
else
{
cnx.avg_download = cntxt.m_recv_cnt / connection_time / 1024;
cnx.avg_upload = cntxt.m_send_cnt / connection_time / 1024;
}
cnx.current_download = cntxt.m_current_speed_down / 1024;
cnx.current_upload = cntxt.m_current_speed_up / 1024;
connections.push_back(cnx);
return true;
@ -543,6 +579,7 @@ namespace cryptonote
LOG_PRINT_CCONTEXT_L2("Block process time: " << block_process_time + transactions_process_time << "(" << transactions_process_time << "/" << block_process_time << ")ms");
epee::net_utils::data_logger::get_instance().add_data("calc_time", block_process_time + transactions_process_time);
epee::net_utils::data_logger::get_instance().add_data("block_processing", 1);
} // each download block