issue #130 - have Process::gettotal include closed connections removed from ConnList
This commit is contained in:
@@ -102,6 +102,9 @@ void Process::getkbps(float *recvd, float *sent) {
|
||||
ConnList *previous = NULL;
|
||||
while (curconn != NULL) {
|
||||
if (curconn->getVal()->getLastPacket() <= curtime.tv_sec - CONNTIMEOUT) {
|
||||
/* capture sent and received totals before deleting */
|
||||
this->sent_by_closed_bytes += curconn->getVal()->sumSent;
|
||||
this->rcvd_by_closed_bytes += curconn->getVal()->sumRecv;
|
||||
/* stalled connection, remove. */
|
||||
ConnList *todelete = curconn;
|
||||
Connection *conn_todelete = curconn->getVal();
|
||||
@@ -137,8 +140,8 @@ void Process::gettotal(u_int32_t *recvd, u_int32_t *sent) {
|
||||
}
|
||||
// std::cout << "Sum sent: " << sum_sent << std::endl;
|
||||
// std::cout << "Sum recv: " << sum_recv << std::endl;
|
||||
*recvd = sum_recv;
|
||||
*sent = sum_sent;
|
||||
*recvd = sum_recv + this->rcvd_by_closed_bytes;
|
||||
*sent = sum_sent + this->sent_by_closed_bytes;
|
||||
}
|
||||
|
||||
void Process::gettotalmb(float *recvd, float *sent) {
|
||||
|
||||
@@ -78,6 +78,8 @@ public:
|
||||
connections = NULL;
|
||||
pid = 0;
|
||||
uid = 0;
|
||||
sent_by_closed_bytes = 0;
|
||||
rcvd_by_closed_bytes = 0;
|
||||
}
|
||||
void check() { assert(pid >= 0); }
|
||||
|
||||
@@ -99,6 +101,8 @@ public:
|
||||
char *cmdline;
|
||||
const char *devicename;
|
||||
int pid;
|
||||
u_int32_t sent_by_closed_bytes;
|
||||
u_int32_t rcvd_by_closed_bytes;
|
||||
|
||||
ConnList *connections;
|
||||
uid_t getUid() { return uid; }
|
||||
|
||||
Reference in New Issue
Block a user