mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-27 05:55:50 +00:00
Tidying:
* Add missing includes * Use preincrement * Rearrange some declarations * Fix some comments
This commit is contained in:
@@ -80,10 +80,6 @@ public:
|
|||||||
virtual int getFlags (uint256 const& index) = 0;
|
virtual int getFlags (uint256 const& index) = 0;
|
||||||
|
|
||||||
virtual bool swapSet (uint256 const& index, std::set<PeerShortID>& peers, int flag) = 0;
|
virtual bool swapSet (uint256 const& index, std::set<PeerShortID>& peers, int flag) = 0;
|
||||||
|
|
||||||
// VFALCO TODO This appears to be unused!
|
|
||||||
//
|
|
||||||
// virtual Entry getEntry (uint256 const&) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@
|
|||||||
#ifndef RIPPLE_BASICS_STRHEX_H_INCLUDED
|
#ifndef RIPPLE_BASICS_STRHEX_H_INCLUDED
|
||||||
#define RIPPLE_BASICS_STRHEX_H_INCLUDED
|
#define RIPPLE_BASICS_STRHEX_H_INCLUDED
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ bool Base58::decode (const char* psz, Blob& vchRet, Alphabet const& alphabet)
|
|||||||
bn += bnChar;
|
bn += bnChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get bignum as little endian data
|
// Get bignum as big endian data
|
||||||
Blob vchTmp = bn.getvch ();
|
Blob vchTmp = bn.getvch ();
|
||||||
|
|
||||||
// Trim off sign byte if present
|
// Trim off sign byte if present
|
||||||
@@ -218,7 +218,7 @@ bool Base58::decode (const char* psz, Blob& vchRet, Alphabet const& alphabet)
|
|||||||
|
|
||||||
vchRet.assign (nLeadingZeros + vchTmp.size (), 0);
|
vchRet.assign (nLeadingZeros + vchTmp.size (), 0);
|
||||||
|
|
||||||
// Convert little endian data to big endian
|
// Convert big endian data to little endian
|
||||||
std::reverse_copy (vchTmp.begin (), vchTmp.end (), vchRet.end () - vchTmp.size ());
|
std::reverse_copy (vchTmp.begin (), vchTmp.end (), vchRet.end () - vchTmp.size ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,30 +97,21 @@ private:
|
|||||||
boost::asio::io_service& io_service_;
|
boost::asio::io_service& io_service_;
|
||||||
boost::optional<boost::asio::io_service::work> work_;
|
boost::optional<boost::asio::io_service::work> work_;
|
||||||
boost::asio::io_service::strand strand_;
|
boost::asio::io_service::strand strand_;
|
||||||
|
|
||||||
std::recursive_mutex mutex_; // VFALCO use std::mutex
|
std::recursive_mutex mutex_; // VFALCO use std::mutex
|
||||||
std::condition_variable_any cond_;
|
std::condition_variable_any cond_;
|
||||||
std::weak_ptr<Timer> timer_;
|
std::weak_ptr<Timer> timer_;
|
||||||
boost::container::flat_map<
|
boost::container::flat_map<
|
||||||
Child*, std::weak_ptr<Child>> list_;
|
Child*, std::weak_ptr<Child>> list_;
|
||||||
|
|
||||||
Setup setup_;
|
Setup setup_;
|
||||||
beast::Journal journal_;
|
beast::Journal journal_;
|
||||||
ServerHandler& serverHandler_;
|
ServerHandler& serverHandler_;
|
||||||
|
|
||||||
Resource::Manager& m_resourceManager;
|
Resource::Manager& m_resourceManager;
|
||||||
|
|
||||||
std::unique_ptr <PeerFinder::Manager> m_peerFinder;
|
std::unique_ptr <PeerFinder::Manager> m_peerFinder;
|
||||||
|
|
||||||
hash_map <PeerFinder::Slot::ptr,
|
hash_map <PeerFinder::Slot::ptr,
|
||||||
std::weak_ptr <PeerImp>> m_peers;
|
std::weak_ptr <PeerImp>> m_peers;
|
||||||
|
|
||||||
hash_map<RippleAddress, std::weak_ptr<PeerImp>> m_publicKeyMap;
|
hash_map<RippleAddress, std::weak_ptr<PeerImp>> m_publicKeyMap;
|
||||||
|
|
||||||
hash_map<Peer::id_t, std::weak_ptr<PeerImp>> m_shortIdMap;
|
hash_map<Peer::id_t, std::weak_ptr<PeerImp>> m_shortIdMap;
|
||||||
|
|
||||||
Resolver& m_resolver;
|
Resolver& m_resolver;
|
||||||
|
|
||||||
std::atomic <Peer::id_t> next_id_;
|
std::atomic <Peer::id_t> next_id_;
|
||||||
|
|
||||||
int timer_count_;
|
int timer_count_;
|
||||||
@@ -212,7 +203,7 @@ public:
|
|||||||
void
|
void
|
||||||
activate (std::shared_ptr<PeerImp> const& peer);
|
activate (std::shared_ptr<PeerImp> const& peer);
|
||||||
|
|
||||||
/** Called when an active peer is destroyed. */
|
// Called when an active peer is destroyed.
|
||||||
void
|
void
|
||||||
onPeerDeactivate (Peer::id_t id, RippleAddress const& publicKey);
|
onPeerDeactivate (Peer::id_t id, RippleAddress const& publicKey);
|
||||||
|
|
||||||
@@ -259,6 +250,11 @@ private:
|
|||||||
void
|
void
|
||||||
connect (beast::IP::Endpoint const& remote_endpoint) override;
|
connect (beast::IP::Endpoint const& remote_endpoint) override;
|
||||||
|
|
||||||
|
/* The number of active peers on the network
|
||||||
|
Active peers are only those peers that have completed the handshake
|
||||||
|
and are running the Ripple protocol.
|
||||||
|
*/
|
||||||
|
// VFALCO Why private?
|
||||||
std::size_t
|
std::size_t
|
||||||
size() override;
|
size() override;
|
||||||
|
|
||||||
|
|||||||
@@ -144,15 +144,15 @@ write (Streambuf& streambuf,
|
|||||||
{
|
{
|
||||||
auto const size = m.ByteSize();
|
auto const size = m.ByteSize();
|
||||||
std::array<std::uint8_t, 6> v;
|
std::array<std::uint8_t, 6> v;
|
||||||
v[0] = static_cast<std::uint8_t> ((size >> 24) & 0xFF);
|
v[0] = static_cast<std::uint8_t>((size >> 24) & 0xFF);
|
||||||
v[1] = static_cast<std::uint8_t> ((size >> 16) & 0xFF);
|
v[1] = static_cast<std::uint8_t>((size >> 16) & 0xFF);
|
||||||
v[2] = static_cast<std::uint8_t> ((size >> 8) & 0xFF);
|
v[2] = static_cast<std::uint8_t>((size >> 8) & 0xFF);
|
||||||
v[3] = static_cast<std::uint8_t> ( size & 0xFF);
|
v[3] = static_cast<std::uint8_t>( size & 0xFF);
|
||||||
v[4] = static_cast<std::uint8_t> ((type >> 8) & 0xFF);
|
v[4] = static_cast<std::uint8_t>((type >> 8) & 0xFF);
|
||||||
v[5] = static_cast<std::uint8_t> ( type & 0xFF);
|
v[5] = static_cast<std::uint8_t>( type & 0xFF);
|
||||||
|
|
||||||
streambuf.commit(boost::asio::buffer_copy(
|
streambuf.commit(boost::asio::buffer_copy(
|
||||||
streambuf.prepare(Message::kHeaderBytes), boost::asio::buffer(v)));
|
streambuf.prepare(Message::kHeaderBytes),
|
||||||
|
boost::asio::buffer(v)));
|
||||||
ZeroCopyOutputStream<Streambuf> stream (
|
ZeroCopyOutputStream<Streambuf> stream (
|
||||||
streambuf, blockBytes);
|
streambuf, blockBytes);
|
||||||
m.SerializeToZeroCopyStream(&stream);
|
m.SerializeToZeroCopyStream(&stream);
|
||||||
|
|||||||
@@ -32,6 +32,18 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
enum VersionEncoding
|
||||||
|
{
|
||||||
|
VER_NONE = 1,
|
||||||
|
VER_NODE_PUBLIC = 28,
|
||||||
|
VER_NODE_PRIVATE = 32,
|
||||||
|
VER_ACCOUNT_ID = 0,
|
||||||
|
VER_ACCOUNT_PUBLIC = 35,
|
||||||
|
VER_ACCOUNT_PRIVATE = 34,
|
||||||
|
VER_FAMILY_GENERATOR = 41,
|
||||||
|
VER_FAMILY_SEED = 33,
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Used to hold addresses and parse and produce human formats.
|
// Used to hold addresses and parse and produce human formats.
|
||||||
//
|
//
|
||||||
@@ -40,18 +52,6 @@ namespace ripple {
|
|||||||
class RippleAddress : private CBase58Data
|
class RippleAddress : private CBase58Data
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum VersionEncoding
|
|
||||||
{
|
|
||||||
VER_NONE = 1,
|
|
||||||
VER_NODE_PUBLIC = 28,
|
|
||||||
VER_NODE_PRIVATE = 32,
|
|
||||||
VER_ACCOUNT_ID = 0,
|
|
||||||
VER_ACCOUNT_PUBLIC = 35,
|
|
||||||
VER_ACCOUNT_PRIVATE = 34,
|
|
||||||
VER_FAMILY_GENERATOR = 41,
|
|
||||||
VER_FAMILY_SEED = 33,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool mIsValid;
|
bool mIsValid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
// The prefix codes are part of the Ripple protocol and existing codes cannot be
|
// The prefix codes are part of the Ripple protocol
|
||||||
// arbitrarily changed.
|
// and existing codes cannot be arbitrarily changed.
|
||||||
|
|
||||||
HashPrefix const HashPrefix::transactionID ('T', 'X', 'N');
|
HashPrefix const HashPrefix::transactionID ('T', 'X', 'N');
|
||||||
HashPrefix const HashPrefix::txNode ('S', 'N', 'D');
|
HashPrefix const HashPrefix::txNode ('S', 'N', 'D');
|
||||||
|
|||||||
Reference in New Issue
Block a user