beast cleanup and tidying:

* Replace custom types with C++11 <cstdint> types
* Fix sqlite integer intos and uses
* Fix String implicit integer constructors
* Escape the enclosing namespace in sqdb
* Replace contract checks with assert
* Make many header files compile independently
* Remove the dependence on beast_core.h in many places
* Remove unused or obsolete classes and functions
* Remove unused or obsolete macros
* Remove unused network functions and files
* Remove unused or obsolete classes:
  - ChildProcess
  - HighResolutionTimer
  - InterProcessLock
  - Throw
  - TrackedMutex
  - UntrackedMutex
  - XmlDocument
  - XmlElement
This commit is contained in:
Vinnie Falco
2014-03-22 09:43:11 -07:00
parent 936f45c7ec
commit b2d97703c6
440 changed files with 3139 additions and 9643 deletions

View File

@@ -53,7 +53,7 @@ public:
/** Uniquely identifies a particular connection of a peer
This works upto a restart of rippled.
*/
typedef beast::uint32 ShortId;
typedef std::uint32_t ShortId;
virtual void sendPacket (const PackedMessage::pointer& packet, bool onStrand) = 0;
@@ -72,11 +72,11 @@ public:
virtual uint256 const& getClosedLedgerHash () const = 0;
virtual bool hasLedger (uint256 const& hash, beast::uint32 seq) const = 0;
virtual bool hasLedger (uint256 const& hash, std::uint32_t seq) const = 0;
virtual void getLedger (protocol::TMGetLedger &) = 0;
virtual void ledgerRange (beast::uint32& minSeq, beast::uint32& maxSeq) const = 0;
virtual void ledgerRange (std::uint32_t& minSeq, std::uint32_t& maxSeq) const = 0;
virtual bool hasTxSet (uint256 const& hash) const = 0;
@@ -90,7 +90,7 @@ public:
virtual bool supportsVersion (int version) = 0;
virtual bool hasRange (beast::uint32 uMin, beast::uint32 uMax) = 0;
virtual bool hasRange (std::uint32_t uMin, std::uint32_t uMax) = 0;
virtual beast::IP::Endpoint getRemoteAddress() const = 0;

View File

@@ -24,11 +24,14 @@
#include "../../ripple/peerfinder/api/Slot.h"
#include "../../ripple/common/Resolver.h"
#include <set>
#include "../../beast/beast/threads/Stoppable.h"
#include "../../beast/modules/beast_core/files/File.h"
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <set>
namespace ripple {
namespace PeerFinder {

View File

@@ -76,7 +76,7 @@ private:
static const boost::posix_time::seconds nodeVerifySeconds;
/** The clock drift we allow a remote peer to have */
static const beast::uint32 clockToleranceDeltaSeconds = 20;
static const std::uint32_t clockToleranceDeltaSeconds = 20;
/** The length of the smallest valid finished message */
static const size_t sslMinimumFinishedLength = 12;
@@ -529,7 +529,7 @@ public:
ret["protocol"] = BuildInfo::Protocol (mHello.protoversion ()).toStdString ();
}
beast::uint32 minSeq, maxSeq;
std::uint32_t minSeq, maxSeq;
ledgerRange(minSeq, maxSeq);
if ((minSeq != 0) || (maxSeq != 0))
@@ -582,7 +582,7 @@ public:
return m_closedLedgerHash;
}
bool hasLedger (uint256 const& hash, beast::uint32 seq) const
bool hasLedger (uint256 const& hash, std::uint32_t seq) const
{
boost::mutex::scoped_lock sl(m_recentLock);
@@ -598,7 +598,7 @@ public:
return false;
}
void ledgerRange (beast::uint32& minSeq, beast::uint32& maxSeq) const
void ledgerRange (std::uint32_t& minSeq, std::uint32_t& maxSeq) const
{
boost::mutex::scoped_lock sl(m_recentLock);
@@ -645,7 +645,7 @@ public:
return mHello.has_protoversion () && (mHello.protoversion () >= version);
}
bool hasRange (beast::uint32 uMin, beast::uint32 uMax)
bool hasRange (std::uint32_t uMin, std::uint32_t uMax)
{
return (uMin >= m_minLedger) && (uMax <= m_maxLedger);
}
@@ -748,7 +748,7 @@ private:
m_journal.info << "ReadBody: " << ec.message ();
{
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
Application::ScopedLockType lock (getApp ().getMasterLock ());
detach ("hrb");
}
@@ -1352,14 +1352,14 @@ private:
(void) m_timer.cancel ();
beast::uint32 const ourTime (getApp().getOPs ().getNetworkTimeNC ());
beast::uint32 const minTime (ourTime - clockToleranceDeltaSeconds);
beast::uint32 const maxTime (ourTime + clockToleranceDeltaSeconds);
std::uint32_t const ourTime (getApp().getOPs ().getNetworkTimeNC ());
std::uint32_t const minTime (ourTime - clockToleranceDeltaSeconds);
std::uint32_t const maxTime (ourTime + clockToleranceDeltaSeconds);
#ifdef BEAST_DEBUG
if (packet.has_nettime ())
{
beast::int64 to = ourTime;
std::int64_t to = ourTime;
to -= packet.nettime ();
m_journal.debug << "Connect: time offset " << to;
}
@@ -1559,7 +1559,7 @@ private:
void recvValidation (const boost::shared_ptr<protocol::TMValidation>& packet)
{
beast::uint32 closeTime = getApp().getOPs().getCloseTimeNC();
std::uint32_t closeTime = getApp().getOPs().getCloseTimeNC();
if (packet->validation ().size () < 50)
{
@@ -1767,7 +1767,7 @@ private:
else
{
// this is a reply
beast::uint32 pLSeq = 0;
std::uint32_t pLSeq = 0;
bool pLDo = true;
bool progress = false;
@@ -1912,7 +1912,7 @@ private:
SHAMapAddNode san;
{
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
Application::ScopedLockType lock (getApp ().getMasterLock ());
san = getApp().getOPs ().gotTXData (shared_from_this (), hash, nodeIDs, nodeData);
}
@@ -2057,7 +2057,7 @@ private:
uint256 consensusLCL;
{
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
Application::ScopedLockType lock (getApp ().getMasterLock ());
consensusLCL = getApp().getOPs ().getConsensusLCL ();
}
@@ -2092,7 +2092,7 @@ private:
addTxSet (hash);
{
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
Application::ScopedLockType lock (getApp ().getMasterLock ());
if (!getApp().getOPs ().hasTXSet (shared_from_this (), hash, packet.status ()))
charge (Resource::feeUnwantedData);
@@ -2218,7 +2218,7 @@ private:
memcpy (txHash.begin (), packet.ledgerhash ().data (), 32);
{
Application::ScopedLockType lock (getApp ().getMasterLock (), __FILE__, __LINE__);
Application::ScopedLockType lock (getApp ().getMasterLock ());
map = getApp().getOPs ().getTXMap (txHash);
}
@@ -2292,7 +2292,7 @@ private:
if (!ledger && (packet.has_querytype () && !packet.has_requestcookie ()))
{
beast::uint32 seq = 0;
std::uint32_t seq = 0;
if (packet.has_ledgerseq ())
seq = packet.ledgerseq ();

View File

@@ -21,8 +21,11 @@
#include "PeerImp.h"
#include "../../ripple/common/seconds_clock.h"
#include "../../beast/beast/ByteOrder.h"
#include <boost/config.hpp>
#include <cassert>
#include <condition_variable>
#include <mutex>
@@ -535,14 +538,14 @@ public:
boost::unordered::piecewise_construct,
boost::make_tuple (peer->getShortId()),
boost::make_tuple (peer)));
check_postcondition(idResult.second);
assert(idResult.second);
std::pair<PeerByPublicKey::iterator, bool> keyResult(
m_publicKeyMap.emplace (
boost::unordered::piecewise_construct,
boost::make_tuple (peer->getNodePublic()),
boost::make_tuple (peer)));
check_postcondition(keyResult.second);
assert(keyResult.second);
m_journal.debug <<
"activated " << peer->getRemoteAddress() <<
@@ -550,7 +553,7 @@ public:
":" << RipplePublicKey(peer->getNodePublic()) << ")";
// We just accepted this peer so we have non-zero active peers
check_postcondition(size() != 0);
assert(size() != 0);
}
/** A peer is being disconnected

View File

@@ -20,8 +20,6 @@
#ifndef RIPPLE_OVERLAY_H_INCLUDED
#define RIPPLE_OVERLAY_H_INCLUDED
#include "../beast/modules/beast_core/beast_core.h"
#include "../ripple_data/ripple_data.h"
#include "api/PackedMessage.h"