PeerFinder work

This commit is contained in:
Vinnie Falco
2013-09-30 09:35:29 -07:00
parent 41879d8511
commit 4fe63f9f0d
44 changed files with 2327 additions and 489 deletions

View File

@@ -1,77 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_VALIDATORS_AGEDHISTORY_H_INCLUDED
#define RIPPLE_VALIDATORS_AGEDHISTORY_H_INCLUDED
namespace ripple {
namespace Validators {
// Simple container swapping template
template <class Container>
class AgedHistory
{
public:
typedef Container container_type;
AgedHistory()
: m_p1 (&m_c1)
, m_p2 (&m_c2)
{
}
AgedHistory (AgedHistory const& other)
: m_c1 (other.front())
, m_c2 (other.back())
, m_p1 (&m_c1)
, m_p2 (&m_c2)
{
}
AgedHistory& operator= (AgedHistory const& other)
{
m_c1 = other.front();
m_c2 = other.back();
m_p1 = &m_c1;
m_p2 = &m_c2;
return *this;
}
void swap () { std::swap (m_p1, m_p2); }
Container* operator-> () { return m_p1; }
Container const* operator-> () const { return m_p1; }
Container& front() { return *m_p1; }
Container const& front() const { return *m_p1; }
Container& back() { return *m_p2; }
Container const& back() const { return *m_p2; }
private:
Container m_c1;
Container m_c2;
Container* m_p1;
Container* m_p2;
};
}
}
#endif

View File

@@ -20,8 +20,6 @@
#ifndef RIPPLE_VALIDATORS_LOGIC_H_INCLUDED
#define RIPPLE_VALIDATORS_LOGIC_H_INCLUDED
#include "AgedHistory.h"
namespace ripple {
namespace Validators {

View File

@@ -253,7 +253,7 @@ public:
void onPrepare (Journal journal)
{
#if RIPPLE_USE_NEW_VALIDATORS
journal.info << "Preparing";
journal.info << "Validators preparing";
addRPCHandlers();
#endif
@@ -262,7 +262,7 @@ public:
void onStart (Journal journal)
{
#if RIPPLE_USE_NEW_VALIDATORS
journal.info << "Starting";
journal.info << "Validators starting";
// Do this late so the sources have a chance to be added.
m_queue.dispatch (bind (&ManagerImp::setCheckSources, this));
@@ -273,7 +273,7 @@ public:
void onStop (Journal journal)
{
journal.info << "Stopping";
journal.info << "Validators stopping";
if (this->Thread::isThreadRunning())
{

View File

@@ -159,11 +159,12 @@ void StoreSqdb::update (SourceDesc& desc, bool updateFetchResults)
if (! error)
{
error = tr.commit ();
error = tr.commit();
}
if (error)
{
tr.rollback ();
report (error, __FILE__, __LINE__);
}
}