diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-11-17 23:52:50 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-11-18 00:13:07 +0000 |
commit | 310b790a64648b088badeb5cbedaddce7fe8c35b (patch) | |
tree | 6792ffa5f1768e2af3f01fb5f3d9f09fe3dad086 | |
parent | Merge pull request #2818 (diff) | |
download | monero-310b790a64648b088badeb5cbedaddce7fe8c35b.tar.xz |
make connection_id a string in RPC
It's sent as JSON, so raw binary is not appropriate
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_defs.h | 4 | ||||
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 2 | ||||
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 5 | ||||
-rw-r--r-- | src/rpc/core_rpc_server_commands_defs.h | 4 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_defs.h b/src/cryptonote_protocol/cryptonote_protocol_defs.h index 1804cc101..7cf7e4a4d 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_defs.h +++ b/src/cryptonote_protocol/cryptonote_protocol_defs.h @@ -74,7 +74,7 @@ namespace cryptonote uint32_t support_flags; - boost::uuids::uuid connection_id; + std::string connection_id; uint64_t height; @@ -98,7 +98,7 @@ namespace cryptonote KV_SERIALIZE(avg_upload) KV_SERIALIZE(current_upload) KV_SERIALIZE(support_flags) - KV_SERIALIZE_VAL_POD_AS_BLOB(connection_id) + KV_SERIALIZE(connection_id) KV_SERIALIZE(height) END_KV_SERIALIZE_MAP() }; diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 73433a8d8..9ae24551c 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -244,7 +244,7 @@ namespace cryptonote cnx.current_download = cntxt.m_current_speed_down / 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; diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 6e7fb7e8e..fdbefa8bf 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -1745,12 +1745,13 @@ namespace cryptonote res.peers.push_back({c}); const cryptonote::block_queue &block_queue = m_p2p.get_payload_object().get_block_queue(); 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); std::string address = ""; 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; - 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; }); diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 15b4b503a..7eed716cf 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -2075,7 +2075,7 @@ namespace cryptonote { uint64_t start_block_height; uint64_t nblocks; - boost::uuids::uuid connection_id; + std::string connection_id; uint32_t rate; uint32_t speed; uint64_t size; @@ -2084,7 +2084,7 @@ namespace cryptonote BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(start_block_height) KV_SERIALIZE(nblocks) - KV_SERIALIZE_VAL_POD_AS_BLOB(connection_id) + KV_SERIALIZE(connection_id) KV_SERIALIZE(rate) KV_SERIALIZE(speed) KV_SERIALIZE(size) |