Refactor PeerFinder:

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
This commit is contained in:
Vinnie Falco
2014-10-07 18:00:14 -07:00
parent 5f59282ba1
commit 7c0c2419f7
18 changed files with 816 additions and 1120 deletions

View File

@@ -2837,13 +2837,8 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\peerfinder\impl\Bootcache.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\peerfinder\impl\Checker.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\peerfinder\impl\Checker.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\peerfinder\impl\CheckerAdapter.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\peerfinder\impl\Config.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -3984,15 +3984,9 @@
<ClInclude Include="..\..\src\ripple\peerfinder\impl\Bootcache.h">
<Filter>ripple\peerfinder\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\peerfinder\impl\Checker.cpp">
<Filter>ripple\peerfinder\impl</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\peerfinder\impl\Checker.h">
<Filter>ripple\peerfinder\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\peerfinder\impl\CheckerAdapter.h">
<Filter>ripple\peerfinder\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\peerfinder\impl\Config.cpp">
<Filter>ripple\peerfinder\impl</Filter>
</ClCompile>