rtorrent icon indicating copy to clipboard operation
rtorrent copied to clipboard

rpc: handle XML-RPC with JSON-RPC logics

Open jesec opened this issue 2 years ago • 2 comments

This allows us to centralize on a single set of RPC logics, sharing the exception handling, error codes/messages and behaviors.

This improves consistency, reduces maintenance burden, makes future extension to RPC parts easier. In addition, we can ditch the dependency on decade-old xmlrpc-c library.

As for the performance, we performed a test with 10,000 torrents in a typical d.multicall2 call, which showed JSON-RPC is 3x faster, compared to XML-RPC (xmlrpc-c). Meanwhile, rapidxml is 3-9x faster, compared to expat/libxml. That means even with the conversion, we shouldn't see much of a performance ding. We may even have a win.

jesec avatar Jul 03 '23 23:07 jesec

Codecov Report

Patch coverage: 1.58% and project coverage change: -0.85 :warning:

Comparison is base (88fd968) 7.95% compared to head (5ae8972) 7.11%.

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #65      +/-   ##
=========================================
- Coverage    7.95%   7.11%   -0.85%     
=========================================
  Files         162     171       +9     
  Lines       10497   12006    +1509     
=========================================
+ Hits          835     854      +19     
- Misses       9662   11152    +1490     
Impacted Files Coverage Δ
include/rpc/rpc_json.h 0.00% <ø> (ø)
include/utils/rapidxml/rapidxml.hpp 0.00% <ø> (ø)
include/utils/rapidxml/rapidxml_print.hpp 0.00% <0.00%> (ø)
src/rpc/rpc_json.cc 0.00% <0.00%> (ø)
src/rpc/rpc_xml.cc 0.00% <0.00%> (ø)
src/rpc/scgi.cc 0.00% <0.00%> (ø)
include/rpc/rpc_xml.h 28.57% <33.33%> (+28.57%) :arrow_up:
src/rpc/rpc_manager.cc 25.00% <100.00%> (+1.74%) :arrow_up:

... and 16 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jul 03 '23 23:07 codecov[bot]

Is there room for a shim for system.multicall? I can take a stab at it myself if needed.

kannibalox avatar Sep 14 '23 01:09 kannibalox