issue #130 - have Process::gettotal include closed connections removed from ConnList

This commit is contained in:
Jason Antman
2017-08-26 08:08:47 -04:00
parent 99a38c003c
commit 226ec6ccdb
2 changed files with 9 additions and 2 deletions

View File

@@ -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) {