aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/connection_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptonote_basic/connection_context.h')
-rw-r--r--src/cryptonote_basic/connection_context.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cryptonote_basic/connection_context.h b/src/cryptonote_basic/connection_context.h
index 9e012f8f5..a7d688300 100644
--- a/src/cryptonote_basic/connection_context.h
+++ b/src/cryptonote_basic/connection_context.h
@@ -31,6 +31,7 @@
#pragma once
#include <unordered_set>
#include <atomic>
+#include <algorithm>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "net/net_utils_base.h"
#include "copyable_atomic.h"
@@ -38,7 +39,6 @@
namespace cryptonote
{
-
struct cryptonote_connection_context: public epee::net_utils::connection_context_base
{
cryptonote_connection_context(): m_state(state_before_handshake), m_remote_blockchain_height(0), m_last_response_height(0),
@@ -55,6 +55,12 @@ namespace cryptonote
state_normal
};
+ static constexpr int handshake_command() noexcept { return 1001; }
+ bool handshake_complete() const noexcept { return m_state != state_before_handshake; }
+
+ //! \return Maximum number of bytes permissible for `command`.
+ static size_t get_max_bytes(int command) noexcept;
+
state m_state;
std::vector<std::pair<crypto::hash, uint64_t>> m_needed_objects;
std::unordered_set<crypto::hash> m_requested_objects;