mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix clang compile
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_PEERFINDER_LEGACYENDPOINTCACHE_H_INCLUDED
|
||||
#define RIPPLE_PEERFINDER_LEGACYENDPOINTCACHE_H_INCLUDED
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace ripple {
|
||||
namespace PeerFinder {
|
||||
|
||||
@@ -30,6 +32,7 @@ public:
|
||||
typedef std::vector <LegacyEndpoint const*> FlattenedList;
|
||||
|
||||
private:
|
||||
#if 0
|
||||
typedef boost::multi_index_container <
|
||||
LegacyEndpoint, boost::multi_index::indexed_by <
|
||||
boost::multi_index::hashed_unique <
|
||||
@@ -39,6 +42,8 @@ private:
|
||||
> MapType;
|
||||
|
||||
MapType m_map;
|
||||
#endif
|
||||
|
||||
Store& m_store;
|
||||
Journal m_journal;
|
||||
int m_mutationCount;
|
||||
@@ -71,10 +76,12 @@ private:
|
||||
FlattenedList flatten () const
|
||||
{
|
||||
FlattenedList list;
|
||||
#if 0
|
||||
list.reserve (m_map.size());
|
||||
for (MapType::iterator iter (m_map.begin());
|
||||
iter != m_map.end(); ++iter)
|
||||
list.push_back (&*iter);
|
||||
#endif
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -116,6 +123,7 @@ private:
|
||||
std::random_shuffle (list.begin(), list.end());
|
||||
std::sort (list.begin(), list.end(), PruneLess());
|
||||
FlattenedList::const_iterator pos (list.begin() + list.size()/2 + 1);
|
||||
#if 0
|
||||
std::size_t const n (m_map.size() - (pos - list.begin()));
|
||||
MapType map;
|
||||
for (FlattenedList::const_iterator iter (list.begin());
|
||||
@@ -123,6 +131,7 @@ private:
|
||||
map.insert (**iter);
|
||||
std::swap (map, m_map);
|
||||
m_journal.info << "Pruned " << n << " legacy endpoints";
|
||||
#endif
|
||||
mutate();
|
||||
}
|
||||
|
||||
@@ -160,7 +169,11 @@ public:
|
||||
|
||||
std::size_t size() const
|
||||
{
|
||||
#if 0
|
||||
return m_map.size();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Load the legacy endpoints cache from the database. */
|
||||
@@ -173,16 +186,18 @@ public:
|
||||
for (List::const_iterator iter (list.begin());
|
||||
iter != list.end(); ++iter)
|
||||
{
|
||||
#if 0
|
||||
std::pair <LegacyEndpoint const&, bool> result (insert (*iter, now));
|
||||
if (result.second)
|
||||
++n;
|
||||
#endif
|
||||
}
|
||||
m_journal.debug << "Loaded " << n << " legacy endpoints";
|
||||
m_mutationCount = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/** Attempt to insert the endpoint.
|
||||
The caller is responsible for making sure the address is valid.
|
||||
The return value provides a reference to the new or existing endpoint.
|
||||
The bool indicates whether or not the insertion took place.
|
||||
*/
|
||||
@@ -196,13 +211,16 @@ public:
|
||||
mutate();
|
||||
return std::make_pair (*result.first, result.second);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Returns a pointer to the legacy endpoint if it exists, else nullptr. */
|
||||
LegacyEndpoint const* find (IPAddress const& address)
|
||||
{
|
||||
#if 0
|
||||
MapType::iterator iter (m_map.find (address));
|
||||
if (iter != m_map.end())
|
||||
return &*iter;
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace PeerFinder {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
typedef boost::multi_index_container <
|
||||
PeerInfo, boost::multi_index::indexed_by <
|
||||
boost::multi_index::hashed_unique <
|
||||
@@ -46,6 +47,7 @@ typedef boost::multi_index_container <
|
||||
IPAddress::hasher>
|
||||
>
|
||||
> Peers;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -109,8 +111,10 @@ public:
|
||||
// The current tally of peer slot statistics
|
||||
Slots m_slots;
|
||||
|
||||
#if 0
|
||||
// Our view of the current set of connected peers.
|
||||
Peers m_peers;
|
||||
#endif
|
||||
|
||||
Cache m_cache;
|
||||
|
||||
@@ -278,9 +282,11 @@ public:
|
||||
for (FixedPeers::const_iterator iter (m_fixedPeers.begin());
|
||||
iter != m_fixedPeers.end(); ++iter)
|
||||
{
|
||||
#if 0
|
||||
// Make sure the fixed peer is not already connected
|
||||
if (m_peers.get<1>().find (*iter) == m_peers.get<1>().end())
|
||||
list.push_back (*iter);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,9 +352,11 @@ public:
|
||||
{
|
||||
m_cache.sweep (get_now());
|
||||
|
||||
#if 0
|
||||
for (Peers::iterator iter (m_peers.begin());
|
||||
iter != m_peers.end(); ++iter)
|
||||
iter->received.cycle();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Called when an outbound connection attempt is started
|
||||
@@ -407,10 +415,13 @@ public:
|
||||
if (! inbound)
|
||||
m_legacyCache.checked (address, true);
|
||||
|
||||
#if 0
|
||||
std::pair <Peers::iterator, bool> result (
|
||||
m_peers.insert (
|
||||
PeerInfo (id, address, inbound, get_now())));
|
||||
bassert (result.second);
|
||||
#endif
|
||||
|
||||
m_slots.addPeer (m_config, inbound);
|
||||
|
||||
// VFALCO NOTE Update fixed peers count (HACKED)
|
||||
@@ -428,6 +439,7 @@ public:
|
||||
//
|
||||
void onPeerDisconnected (PeerID const& id)
|
||||
{
|
||||
#if 0
|
||||
Peers::iterator iter (m_peers.find (id));
|
||||
bassert (iter != m_peers.end());
|
||||
PeerInfo const& peer (*iter);
|
||||
@@ -444,6 +456,7 @@ public:
|
||||
|
||||
// Must come last
|
||||
m_peers.erase (iter);
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -530,6 +543,7 @@ public:
|
||||
//
|
||||
void sendEndpoints ()
|
||||
{
|
||||
#if 0
|
||||
if (! m_peers.empty())
|
||||
{
|
||||
m_journal.trace << "Sending endpoints...";
|
||||
@@ -555,6 +569,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Called when the Checker completes a connectivity test
|
||||
@@ -565,6 +580,7 @@ public:
|
||||
if (result.error == boost::asio::error::operation_aborted)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
Peers::iterator iter (m_peers.find (id));
|
||||
if (iter != m_peers.end())
|
||||
{
|
||||
@@ -602,12 +618,14 @@ public:
|
||||
m_journal.debug << "Finished listening test for " <<
|
||||
id << " but the peer disconnected. ";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Called when a peer sends us the mtENDPOINTS message.
|
||||
//
|
||||
void onPeerEndpoints (PeerID const& id, std::vector <Endpoint> list)
|
||||
{
|
||||
#if 0
|
||||
Peers::iterator iter (m_peers.find (id));
|
||||
bassert (iter != m_peers.end());
|
||||
|
||||
@@ -700,6 +718,7 @@ public:
|
||||
}
|
||||
|
||||
peer.whenAcceptEndpoints = now + secondsPerMessage;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -740,10 +759,12 @@ public:
|
||||
for (std::vector <IPAddress>::const_iterator iter (results.list.begin());
|
||||
iter != results.list.end(); ++iter)
|
||||
{
|
||||
#if 0
|
||||
std::pair <LegacyEndpoint const&, bool> result (
|
||||
m_legacyCache.insert (*iter, now));
|
||||
if (result.second)
|
||||
++newEntries;
|
||||
#endif
|
||||
}
|
||||
|
||||
m_journal.debug <<
|
||||
@@ -787,6 +808,7 @@ public:
|
||||
{
|
||||
if (! validIPAddress (address))
|
||||
return;
|
||||
#if 0
|
||||
std::pair <LegacyEndpoint const&, bool> result (
|
||||
m_legacyCache.insert (address, get_now()));
|
||||
if (result.second)
|
||||
@@ -803,6 +825,7 @@ public:
|
||||
this, address, _1));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1367,7 +1367,7 @@ class PosixEnv : public Env {
|
||||
#if (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012
|
||||
pthread_setname_np (pthread_self(), "rocksdb:bg");
|
||||
#else
|
||||
prctl (PR_SET_NAME, "rocksdb:bg", 0, 0, 0);
|
||||
pthread_setname_np("rocksdb:bg");
|
||||
#endif
|
||||
reinterpret_cast<ThreadPool*>(arg)->BGThread();
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user