Add network traffic statistics (#4239)

Co-authored-by: xiongguangjie <xiong_panda@163.com>
Co-authored-by: xia-chu <771730766@qq.com>
This commit is contained in:
PioLing
2025-05-02 16:23:25 +08:00
committed by GitHub
parent ab14adb94d
commit 7b1f8fedac
35 changed files with 325 additions and 19 deletions

View File

@@ -165,6 +165,10 @@ public:
* [AUTO-TRANSLATED:8fb31d43]
*/
virtual void setOnResume(const std::function<void()> &cb) = 0;
virtual size_t getRecvSpeed() { return 0; }
virtual size_t getRecvTotalBytes() { return 0; }
protected:
virtual void onResume() = 0;
@@ -256,6 +260,14 @@ public:
_on_resume = cb;
}
size_t getRecvSpeed() override {
return _delegate ? _delegate->getRecvSpeed() : Parent::getRecvSpeed();
}
size_t getRecvTotalBytes() override {
return _delegate ? _delegate->getRecvTotalBytes() : Parent::getRecvTotalBytes();
}
protected:
void onShutdown(const toolkit::SockException &ex) override {
if (_on_shutdown) {