* Add missing includes
* Use preincrement
* Rearrange some declarations
* Fix some comments
This commit is contained in:
Vinnie Falco
2015-03-11 10:00:59 -07:00
committed by seelabs
parent 7d75041fb1
commit 41a840e776
8 changed files with 2153 additions and 2013 deletions

View File

@@ -80,10 +80,6 @@ public:
virtual int getFlags (uint256 const& index) = 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

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@
#ifndef RIPPLE_BASICS_STRHEX_H_INCLUDED
#define RIPPLE_BASICS_STRHEX_H_INCLUDED
#include <cassert>
#include <string>
namespace ripple {

View File

@@ -203,7 +203,7 @@ bool Base58::decode (const char* psz, Blob& vchRet, Alphabet const& alphabet)
bn += bnChar;
}
// Get bignum as little endian data
// Get bignum as big endian data
Blob vchTmp = bn.getvch ();
// 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);
// 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 ());
return true;
}

View File

@@ -97,30 +97,21 @@ private:
boost::asio::io_service& io_service_;
boost::optional<boost::asio::io_service::work> work_;
boost::asio::io_service::strand strand_;
std::recursive_mutex mutex_; // VFALCO use std::mutex
std::condition_variable_any cond_;
std::weak_ptr<Timer> timer_;
boost::container::flat_map<
Child*, std::weak_ptr<Child>> list_;
Setup setup_;
beast::Journal journal_;
ServerHandler& serverHandler_;
Resource::Manager& m_resourceManager;
std::unique_ptr <PeerFinder::Manager> m_peerFinder;
hash_map <PeerFinder::Slot::ptr,
std::weak_ptr <PeerImp>> m_peers;
hash_map<RippleAddress, std::weak_ptr<PeerImp>> m_publicKeyMap;
hash_map<Peer::id_t, std::weak_ptr<PeerImp>> m_shortIdMap;
Resolver& m_resolver;
std::atomic <Peer::id_t> next_id_;
int timer_count_;
@@ -212,7 +203,7 @@ public:
void
activate (std::shared_ptr<PeerImp> const& peer);
/** Called when an active peer is destroyed. */
// Called when an active peer is destroyed.
void
onPeerDeactivate (Peer::id_t id, RippleAddress const& publicKey);
@@ -259,6 +250,11 @@ private:
void
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
size() override;

View File

@@ -144,15 +144,15 @@ write (Streambuf& streambuf,
{
auto const size = m.ByteSize();
std::array<std::uint8_t, 6> v;
v[0] = static_cast<std::uint8_t> ((size >> 24) & 0xFF);
v[1] = static_cast<std::uint8_t> ((size >> 16) & 0xFF);
v[2] = static_cast<std::uint8_t> ((size >> 8) & 0xFF);
v[3] = static_cast<std::uint8_t> ( size & 0xFF);
v[4] = static_cast<std::uint8_t> ((type >> 8) & 0xFF);
v[5] = static_cast<std::uint8_t> ( type & 0xFF);
v[0] = static_cast<std::uint8_t>((size >> 24) & 0xFF);
v[1] = static_cast<std::uint8_t>((size >> 16) & 0xFF);
v[2] = static_cast<std::uint8_t>((size >> 8) & 0xFF);
v[3] = static_cast<std::uint8_t>( size & 0xFF);
v[4] = static_cast<std::uint8_t>((type >> 8) & 0xFF);
v[5] = static_cast<std::uint8_t>( type & 0xFF);
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 (
streambuf, blockBytes);
m.SerializeToZeroCopyStream(&stream);

View File

@@ -32,6 +32,18 @@
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.
//
@@ -40,18 +52,6 @@ namespace ripple {
class RippleAddress : private CBase58Data
{
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;
public:

View File

@@ -22,8 +22,8 @@
namespace ripple {
// The prefix codes are part of the Ripple protocol and existing codes cannot be
// arbitrarily changed.
// The prefix codes are part of the Ripple protocol
// and existing codes cannot be arbitrarily changed.
HashPrefix const HashPrefix::transactionID ('T', 'X', 'N');
HashPrefix const HashPrefix::txNode ('S', 'N', 'D');