fix proxy traffic not count into traffic (#1229)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Sijie.Sun
2025-08-14 00:05:12 +08:00
committed by GitHub
parent 35ff9b82fc
commit d9bcbd9b31

View File

@@ -986,7 +986,19 @@ impl PeerManager {
}
pub async fn send_msg(&self, msg: ZCPacket, dst_peer_id: PeerId) -> Result<(), Error> {
Self::send_msg_internal(&self.peers, &self.foreign_network_client, msg, dst_peer_id).await
self.self_tx_counters
.self_tx_bytes
.add(msg.buf_len() as u64);
self.self_tx_counters.self_tx_packets.inc();
let msg_len = msg.buf_len() as u64;
let result =
Self::send_msg_internal(&self.peers, &self.foreign_network_client, msg, dst_peer_id)
.await;
if result.is_ok() {
self.self_tx_counters.self_tx_bytes.add(msg_len);
self.self_tx_counters.self_tx_packets.inc();
}
result
}
async fn send_msg_internal(