Merge pull request #1509 from RetroPooh/trafcount

display session traffic
This commit is contained in:
csoler 2019-04-10 21:04:53 +02:00 committed by GitHub
commit 43a5312194
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 59 additions and 11 deletions

View file

@ -186,7 +186,7 @@ class NetInterface;
class PQInterface: public RateInterface
{
public:
explicit PQInterface(const RsPeerId &id) :peerId(id) { return; }
explicit PQInterface(const RsPeerId &id) :peerId(id), traf_in(0), traf_out(0) { return; }
virtual ~PQInterface() { return; }
/*!
@ -228,6 +228,22 @@ class PQInterface: public RateInterface
const sockaddr_storage & /*remote_peer_address*/)
{ return 0; }
virtual uint64_t getTraffic(bool in)
{
uint64_t ret = 0;
if (in)
{
ret = traf_in;
traf_in = 0;
return ret;
}
ret = traf_out;
traf_out = 0;
return ret;
}
uint64_t traf_in;
uint64_t traf_out;
private:
RsPeerId peerId;