mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Previously, the PeerFinder manager constructed with a Callback object provided by the owner which was used to perform operations like connecting, disconnecting, and sending messages. This made it difficult to change the overlay code because a single call into the PeerFinder could cause both OverlayImpl and PeerImp to be re-entered one or more times, sometimes while holding a recursive mutex. This change eliminates the callback by changing PeerFinder functions to return values indicating the action the caller should take. As a result of this change the PeerFinder no longer needs its own dedicated thread. OverlayImpl is changed to call into PeerFinder on a timer to perform periodic activities. Furthermore the Checker class used to perform connectivity checks has been refactored. It no longer uses an abstract base class, in order to not type-erase the handler passed to async_connect (ensuring compatibility with coroutines). To allow unit tests that don't need a network, the Logic class is now templated on the Checker type. Currently the Manager provides its own io_service. However, this can easily be changed so that the io_service is provided upon construction. Summary * Remove unused SiteFiles dependency injection * Remove Callback and update signatures for public APIs * Remove obsolete functions * Move timer to overlay * Steps toward a shared io_service * Templated, simplified Checker * Tidy up Checker declaration
44 lines
1.8 KiB
C++
44 lines
1.8 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
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.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#include <BeastConfig.h>
|
|
|
|
#ifndef NDEBUG
|
|
# define consistency_check(cond) bassert(cond)
|
|
#else
|
|
# define consistency_check(cond)
|
|
#endif
|
|
|
|
#include <ripple/peerfinder/impl/Bootcache.cpp>
|
|
#include <ripple/peerfinder/impl/Config.cpp>
|
|
#include <ripple/peerfinder/impl/Endpoint.cpp>
|
|
#include <ripple/peerfinder/impl/Livecache.cpp>
|
|
#include <ripple/peerfinder/impl/Manager.cpp>
|
|
#include <ripple/peerfinder/impl/SlotImp.cpp>
|
|
#include <ripple/peerfinder/impl/SourceStrings.cpp>
|
|
|
|
#include <ripple/peerfinder/sim/GraphAlgorithms.h>
|
|
#include <ripple/peerfinder/sim/WrappedSink.h>
|
|
#include <ripple/peerfinder/sim/Predicates.h>
|
|
#include <ripple/peerfinder/sim/FunctionQueue.h>
|
|
#include <ripple/peerfinder/sim/Message.h>
|
|
#include <ripple/peerfinder/sim/NodeSnapshot.h>
|
|
#include <ripple/peerfinder/sim/Params.h>
|
|
#include <ripple/peerfinder/sim/Tests.cpp>
|