Merge pull request #2838

310b790a make connection_id a string in RPC (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-12-02 09:23:22 +02:00
commit ed8fc8ac1c
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
4 changed files with 8 additions and 7 deletions

View File

@ -74,7 +74,7 @@ namespace cryptonote
uint32_t support_flags; uint32_t support_flags;
boost::uuids::uuid connection_id; std::string connection_id;
uint64_t height; uint64_t height;
@ -98,7 +98,7 @@ namespace cryptonote
KV_SERIALIZE(avg_upload) KV_SERIALIZE(avg_upload)
KV_SERIALIZE(current_upload) KV_SERIALIZE(current_upload)
KV_SERIALIZE(support_flags) KV_SERIALIZE(support_flags)
KV_SERIALIZE_VAL_POD_AS_BLOB(connection_id) KV_SERIALIZE(connection_id)
KV_SERIALIZE(height) KV_SERIALIZE(height)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };

View File

@ -244,7 +244,7 @@ namespace cryptonote
cnx.current_download = cntxt.m_current_speed_down / 1024; cnx.current_download = cntxt.m_current_speed_down / 1024;
cnx.current_upload = cntxt.m_current_speed_up / 1024; cnx.current_upload = cntxt.m_current_speed_up / 1024;
cnx.connection_id = cntxt.m_connection_id; cnx.connection_id = epee::string_tools::pod_to_hex(cntxt.m_connection_id);
cnx.height = cntxt.m_remote_blockchain_height; cnx.height = cntxt.m_remote_blockchain_height;

View File

@ -1747,12 +1747,13 @@ namespace cryptonote
res.peers.push_back({c}); res.peers.push_back({c});
const cryptonote::block_queue &block_queue = m_p2p.get_payload_object().get_block_queue(); const cryptonote::block_queue &block_queue = m_p2p.get_payload_object().get_block_queue();
block_queue.foreach([&](const cryptonote::block_queue::span &span) { block_queue.foreach([&](const cryptonote::block_queue::span &span) {
const std::string span_connection_id = epee::string_tools::pod_to_hex(span.connection_id);
uint32_t speed = (uint32_t)(100.0f * block_queue.get_speed(span.connection_id) + 0.5f); uint32_t speed = (uint32_t)(100.0f * block_queue.get_speed(span.connection_id) + 0.5f);
std::string address = ""; std::string address = "";
for (const auto &c: m_p2p.get_payload_object().get_connections()) for (const auto &c: m_p2p.get_payload_object().get_connections())
if (c.connection_id == span.connection_id) if (c.connection_id == span_connection_id)
address = c.address; address = c.address;
res.spans.push_back({span.start_block_height, span.nblocks, span.connection_id, (uint32_t)(span.rate + 0.5f), speed, span.size, address}); res.spans.push_back({span.start_block_height, span.nblocks, span_connection_id, (uint32_t)(span.rate + 0.5f), speed, span.size, address});
return true; return true;
}); });

View File

@ -2077,7 +2077,7 @@ namespace cryptonote
{ {
uint64_t start_block_height; uint64_t start_block_height;
uint64_t nblocks; uint64_t nblocks;
boost::uuids::uuid connection_id; std::string connection_id;
uint32_t rate; uint32_t rate;
uint32_t speed; uint32_t speed;
uint64_t size; uint64_t size;
@ -2086,7 +2086,7 @@ namespace cryptonote
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(start_block_height) KV_SERIALIZE(start_block_height)
KV_SERIALIZE(nblocks) KV_SERIALIZE(nblocks)
KV_SERIALIZE_VAL_POD_AS_BLOB(connection_id) KV_SERIALIZE(connection_id)
KV_SERIALIZE(rate) KV_SERIALIZE(rate)
KV_SERIALIZE(speed) KV_SERIALIZE(speed)
KV_SERIALIZE(size) KV_SERIALIZE(size)