Refactor protocol message parsing:

This replaces the stateful class parser with a stateless free function.
The protocol buffer message is parsed using a ZeroCopyInputStream.

* Invoke method is now a free function.
* Protocol handler doesn't need to derive from an abstract interface
* Only up to one message is processed at a time by the invoker.
* Remove error_code return from the handler's message processing functions.
* Add ZeroCopyInputStream implementation that wraps a BufferSequence.
* Free function parses up to one protocol message and calls the handler.
* Message type and size can be calculated from an iterator
  range or a buffer sequence.
This commit is contained in:
Vinnie Falco
2014-11-23 06:43:10 -08:00
committed by Nik Bougalis
parent fb0d44d403
commit aa7b0a31b0
11 changed files with 427 additions and 498 deletions

View File

@@ -2499,18 +2499,9 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\nodestore\Types.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\overlay\impl\abstract_protocol_handler.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\overlay\impl\Message.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple\overlay\impl\message_name.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\overlay\impl\message_name.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\overlay\impl\message_stream.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\overlay\impl\OverlayImpl.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -2521,6 +2512,8 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\overlay\impl\PeerImp.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\overlay\impl\ProtocolMessage.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\overlay\impl\TMHello.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -3522,21 +3522,9 @@
<ClInclude Include="..\..\src\ripple\nodestore\Types.h">
<Filter>ripple\nodestore</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\overlay\impl\abstract_protocol_handler.h">
<Filter>ripple\overlay\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\overlay\impl\Message.cpp">
<Filter>ripple\overlay\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\overlay\impl\message_name.cpp">
<Filter>ripple\overlay\impl</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\overlay\impl\message_name.h">
<Filter>ripple\overlay\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\overlay\impl\message_stream.h">
<Filter>ripple\overlay\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\overlay\impl\OverlayImpl.cpp">
<Filter>ripple\overlay\impl</Filter>
</ClCompile>
@@ -3549,6 +3537,9 @@
<ClInclude Include="..\..\src\ripple\overlay\impl\PeerImp.h">
<Filter>ripple\overlay\impl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\overlay\impl\ProtocolMessage.h">
<Filter>ripple\overlay\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\overlay\impl\TMHello.cpp">
<Filter>ripple\overlay\impl</Filter>
</ClCompile>