core: expose peer output queue size in bytes for improved network monitoring #245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expose per-peer output queue size in bytes for improved network monitoring and decision making
This PR introduces a mechanism to monitor the actual volume of data (in bytes) waiting in the output queue for each peer. This provides a more accurate view of network congestion than simple item counts, allowing services to make better-informed decisions regarding data throttling.
Files modified:
libretroshare/src/pqi/pqi_base.h: Added mQueueOutBytes to the RsBwRates structure.
libretroshare/src/retroshare/rsconfig.h: Added mQueueOutBytes to RsConfigDataRates to expose the data via the public API.
libretroshare/src/pqi/pqistreamer.cc: Implemented the actual byte-size calculation of pending packets using locked_compute_out_pkt_size().
libretroshare/src/pqi/pqiperson.cc: Updated the statistics relay to pass the new byte metric.
libretroshare/src/pqi/pqihandler.cc: Updated the rate extraction logic to aggregate byte counts across all search modules.
libretroshare/src/services/p3bwctrl.cc: Updated the bandwidth control service to store and provide these values through getTotalBandwidthRates() and getAllBandwidthRates().
As a practical example, this data is used in RsGxsNetService to provide a detailed global and per-peer network status report during synchronization.
libretroshare/src/gxs/rsgxsnetservice.cc: Implemented a shared file-scope cache and a throttled 5-second display logic.