diff --git a/SConstruct b/SConstruct index ef576ab688..f31e45b99a 100644 --- a/SConstruct +++ b/SConstruct @@ -48,8 +48,8 @@ if OSX: env.Replace(CC= 'clang') env.Replace(CXX= 'clang++') env.Append(CXXFLAGS = ['-std=c++11', '-stdlib=libc++']) - env.Append(LINKFLAGS='-stdlib=libc++') - env['FRAMEWORKS'] = ['AppKit'] + env.Append(LINKFLAGS='-stdlib=libc++') + env['FRAMEWORKS'] = ['AppKit','Foundation'] GCC_VERSION = re.split('\.', commands.getoutput(env['CXX'] + ' -dumpversion')) @@ -98,7 +98,8 @@ BOOST_LIBS = [ # We whitelist platforms where the non -mt version is linked with pthreads. This # can be verified with: ldd libboost_filesystem.* If a threading library is # included the platform can be whitelisted. -if FreeBSD or Ubuntu or Archlinux or OSX: +if FreeBSD or Ubuntu or Archlinux: +# if FreeBSD or Ubuntu or Archlinux or OSX: # non-mt libs do link with pthreads. env.Append( LIBS = BOOST_LIBS diff --git a/src/beast/beast/Memory.h b/src/beast/beast/Memory.h index 538e82e5a0..a95627542a 100644 --- a/src/beast/beast/Memory.h +++ b/src/beast/beast/Memory.h @@ -27,6 +27,7 @@ #include #include "Config.h" +#include "Uncopyable.h" namespace beast { diff --git a/src/beast/beast/chrono/impl/RelativeTime.cpp b/src/beast/beast/chrono/impl/RelativeTime.cpp index 157cdd67ae..8a79c7fd20 100644 --- a/src/beast/beast/chrono/impl/RelativeTime.cpp +++ b/src/beast/beast/chrono/impl/RelativeTime.cpp @@ -256,23 +256,29 @@ std::string RelativeTime::to_string () const } } - -namespace beast { - -namespace detail { #if BEAST_WINDOWS #include +namespace beast { +namespace detail { + static double monotonicCurrentTimeInSeconds() { return GetTickCount64() / 1000.0; } + +} +} #elif BEAST_MAC || BEAST_IOS -#include +#include +#include + +namespace beast { +namespace detail { static double monotonicCurrentTimeInSeconds() { @@ -309,20 +315,31 @@ static double monotonicCurrentTimeInSeconds() return mach_absolute_time() * data.ratio; } +} +} #else #include +namespace beast { +namespace detail { + static double monotonicCurrentTimeInSeconds() { timespec t; clock_gettime (CLOCK_MONOTONIC, &t); return t.tv_sec + t.tv_nsec / 1000000000.0; } + +} +} #endif +namespace beast { +namespace detail { + // Records and returns the time from process startup static double getStartupTime() { diff --git a/src/beast/beast/config/PlatformConfig.h b/src/beast/beast/config/PlatformConfig.h index ec59dab8d7..5ee181322a 100644 --- a/src/beast/beast/config/PlatformConfig.h +++ b/src/beast/beast/config/PlatformConfig.h @@ -174,7 +174,6 @@ #ifdef __clang__ #define BEAST_CLANG 1 - #define BEAST_GCC 1 #elif defined (__GNUC__) #define BEAST_GCC 1 #elif defined (_MSC_VER) diff --git a/src/beast/beast/threads/impl/Thread.cpp b/src/beast/beast/threads/impl/Thread.cpp index ebc5a4450a..f04782d9b0 100644 --- a/src/beast/beast/threads/impl/Thread.cpp +++ b/src/beast/beast/threads/impl/Thread.cpp @@ -439,9 +439,16 @@ void Thread::yield() #if BEAST_BSD // ??? #elif BEAST_MAC || BEAST_IOS -// Compiles fine without prctl.h +#include +#include +#import +namespace beast{ +#include "../../../modules/beast_core/native/osx_ObjCHelpers.h" +} + #else # include + #endif namespace beast { diff --git a/src/beast/modules/beast_asio/async/AbstractHandler.h b/src/beast/modules/beast_asio/async/AbstractHandler.h index f999b9e5d4..7a92f5bf22 100644 --- a/src/beast/modules/beast_asio/async/AbstractHandler.h +++ b/src/beast/modules/beast_asio/async/AbstractHandler.h @@ -130,7 +130,7 @@ private: /** A reference counted, abstract completion handler. */ template > -class AbstractHandler; +struct AbstractHandler; //------------------------------------------------------------------------------ diff --git a/src/beast/modules/beast_asio/async/SharedHandler.h b/src/beast/modules/beast_asio/async/SharedHandler.h index 9a1c58ed18..ea96265532 100644 --- a/src/beast/modules/beast_asio/async/SharedHandler.h +++ b/src/beast/modules/beast_asio/async/SharedHandler.h @@ -62,14 +62,7 @@ public: virtual void operator() (error_code const&, std::size_t); template - void invoke (BOOST_ASIO_MOVE_ARG(Function) f) - { - // The allocator will hold a reference to the SharedHandler - // so that we can safely destroy the function object. - invoked_type invoked (f, - SharedHandlerAllocator (this)); - invoke (invoked); - } + void invoke (BEAST_MOVE_ARG(Function) f); virtual void invoke (invoked_type& invoked) = 0; virtual void* allocate (std::size_t size) = 0; diff --git a/src/beast/modules/beast_asio/async/SharedHandlerAllocator.h b/src/beast/modules/beast_asio/async/SharedHandlerAllocator.h index 41606f4562..0c61b8b668 100644 --- a/src/beast/modules/beast_asio/async/SharedHandlerAllocator.h +++ b/src/beast/modules/beast_asio/async/SharedHandlerAllocator.h @@ -111,17 +111,13 @@ private: }; //------------------------------------------------------------------------------ - -#if 0 template -void SharedHandler::invoke (BOOST_ASIO_MOVE_ARG(Function) f) +void SharedHandler::invoke (BEAST_MOVE_ARG(Function) f) { // The allocator will hold a reference to the SharedHandler // so that we can safely destroy the function object. - invoked_type invoked (BOOST_ASIO_MOVE_CAST(Function)(f), - SharedHandlerAllocator (this)); + invoked_type invoked (f,SharedHandlerAllocator (this)); invoke (invoked); } -#endif #endif diff --git a/src/beast/modules/beast_asio/sockets/SocketBase.h b/src/beast/modules/beast_asio/sockets/SocketBase.h index 2881589bd0..2504df37f3 100644 --- a/src/beast/modules/beast_asio/sockets/SocketBase.h +++ b/src/beast/modules/beast_asio/sockets/SocketBase.h @@ -25,7 +25,7 @@ */ struct SocketBase { -protected: +public: typedef boost::system::error_code error_code; /** The error returned when a pure virtual is called. diff --git a/src/beast/modules/beast_core/native/osx_ObjCHelpers.h b/src/beast/modules/beast_core/native/osx_ObjCHelpers.h index 29f992296b..42743eedec 100644 --- a/src/beast/modules/beast_core/native/osx_ObjCHelpers.h +++ b/src/beast/modules/beast_core/native/osx_ObjCHelpers.h @@ -24,7 +24,6 @@ #ifndef BEAST_OSX_OBJCHELPERS_H_INCLUDED #define BEAST_OSX_OBJCHELPERS_H_INCLUDED - /* This file contains a few helper functions that are used internally but which need to be kept away from the public headers because they use obj-C symbols. */ diff --git a/src/beast/modules/beast_core/system/BoostPlaceholdersFix.h b/src/beast/modules/beast_core/system/BoostPlaceholdersFix.h index 5fbd1b613a..2711c382b9 100644 --- a/src/beast/modules/beast_core/system/BoostPlaceholdersFix.h +++ b/src/beast/modules/beast_core/system/BoostPlaceholdersFix.h @@ -29,7 +29,6 @@ # define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED #endif -#include #include #include diff --git a/src/hyperleveldb/db/db_impl.cc b/src/hyperleveldb/db/db_impl.cc index 84fff83c4f..6eddbfa4ca 100644 --- a/src/hyperleveldb/db/db_impl.cc +++ b/src/hyperleveldb/db/db_impl.cc @@ -1488,11 +1488,11 @@ struct DBImpl::Writer { Writer* next; uint64_t start_sequence; uint64_t end_sequence; - std::tr1::shared_ptr logfile; - std::tr1::shared_ptr log; + std::shared_ptr logfile; + std::shared_ptr log; MemTable* mem; - std::tr1::shared_ptr old_logfile; - std::tr1::shared_ptr old_log; + std::shared_ptr old_logfile; + std::shared_ptr old_log; explicit Writer() : mtx(), diff --git a/src/hyperleveldb/db/db_impl.h b/src/hyperleveldb/db/db_impl.h index 6ab4e086e2..0c72d88809 100644 --- a/src/hyperleveldb/db/db_impl.h +++ b/src/hyperleveldb/db/db_impl.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "dbformat.h" #include "log_writer.h" @@ -161,9 +161,9 @@ class DBImpl : public DB { MemTable* mem_; MemTable* imm_; // Memtable being compacted port::AtomicPointer has_imm_; // So bg thread can detect non-NULL imm_ - std::tr1::shared_ptr logfile_; + std::shared_ptr logfile_; uint64_t logfile_number_; - std::tr1::shared_ptr log_; + std::shared_ptr log_; uint32_t seed_; // For sampling. // Synchronize writers diff --git a/src/ripple/peerfinder/impl/LegacyEndpointCache.h b/src/ripple/peerfinder/impl/LegacyEndpointCache.h index 1f44d2527d..526bea8890 100644 --- a/src/ripple/peerfinder/impl/LegacyEndpointCache.h +++ b/src/ripple/peerfinder/impl/LegacyEndpointCache.h @@ -20,6 +20,8 @@ #ifndef RIPPLE_PEERFINDER_LEGACYENDPOINTCACHE_H_INCLUDED #define RIPPLE_PEERFINDER_LEGACYENDPOINTCACHE_H_INCLUDED +#include + namespace ripple { namespace PeerFinder { @@ -30,6 +32,7 @@ public: typedef std::vector 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 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; } diff --git a/src/ripple/peerfinder/impl/Logic.h b/src/ripple/peerfinder/impl/Logic.h index 0bb2ee219d..13f1d8526a 100644 --- a/src/ripple/peerfinder/impl/Logic.h +++ b/src/ripple/peerfinder/impl/Logic.h @@ -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 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 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 ::const_iterator iter (results.list.begin()); iter != results.list.end(); ++iter) { +#if 0 std::pair 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 result ( m_legacyCache.insert (address, get_now())); if (result.second) @@ -803,6 +825,7 @@ public: this, address, _1)); #endif } +#endif } }; diff --git a/src/ripple/rocksdb/rocksdb/util/env_posix.cc b/src/ripple/rocksdb/rocksdb/util/env_posix.cc index f18646c34b..4f7fbc9418 100644 --- a/src/ripple/rocksdb/rocksdb/util/env_posix.cc +++ b/src/ripple/rocksdb/rocksdb/util/env_posix.cc @@ -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(arg)->BGThread(); return nullptr; diff --git a/src/ripple_basics/log/LogPartition.h b/src/ripple_basics/log/LogPartition.h index 37ac47b3da..7c9cf18d9b 100644 --- a/src/ripple_basics/log/LogPartition.h +++ b/src/ripple_basics/log/LogPartition.h @@ -52,17 +52,7 @@ public: /** Returns the LogPartition based on a type key. */ template - static LogPartition& get () - { - struct LogPartitionType : LogPartition - { - LogPartitionType () : LogPartition (getPartitionName ()) - { } - }; - - // Each LogPartition is a singleton. - return *SharedSingleton ::getInstance(); - } + static LogPartition& get (); /** Returns a Journal using the specified LogPartition type key. */ template @@ -110,6 +100,19 @@ private: std::string mName; }; +template +LogPartition& LogPartition::get () +{ + struct LogPartitionType : LogPartition + { + LogPartitionType () : LogPartition (getPartitionName ()) + { } + }; + + // Each LogPartition is a singleton. + return *SharedSingleton ::getInstance(); +} + #define SETUP_LOG(Class) \ template <> char const* LogPartition::getPartitionName () { return #Class; } \ struct Class##Instantiator { Class##Instantiator () { LogPartition::get (); } }; \