"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ibw.c" between
vnstat-2.7.tar.gz and vnstat-2.8.tar.gz

About: vnStat is a console-based network traffic monitor (using the /proc filesystem).

ibw.c  (vnstat-2.7):ibw.c  (vnstat-2.8)
skipping to change at line 110 skipping to change at line 110
time_t current; time_t current;
uint32_t speed; uint32_t speed;
*limit = 0; *limit = 0;
current = time(NULL); current = time(NULL);
/* search for interface specific limit */ /* search for interface specific limit */
while (p != NULL) { while (p != NULL) {
if (strcasecmp(p->interface, iface) == 0) { if (strcasecmp(p->interface, iface) == 0) {
if (cfg.bwdetection && p->retries < 5) { /* never override manually configured limits */
if (p->detected == 0 && p->limit > 0) {
*limit = p->limit;
return 1;
}
if (!istun(iface) && cfg.bwdetection && p->retries < 5) {
if (cfg.bwdetectioninterval > 0 && (current - p-> detected) > (cfg.bwdetectioninterval * 60)) { if (cfg.bwdetectioninterval > 0 && (current - p-> detected) > (cfg.bwdetectioninterval * 60)) {
speed = getifspeed(iface); speed = getifspeed(iface);
if (speed > 0) { if (speed > 0) {
if (p->detected > 0 && speed != p ->limit) { if (p->detected > 0 && speed != p ->limit) {
snprintf(errorstring, 102 4, "Detected bandwidth limit for \"%s\" changed from %" PRIu32 " Mbit to %" PRIu 32 " Mbit.", iface, p->limit, speed); snprintf(errorstring, 102 4, "Detected bandwidth limit for \"%s\" changed from %" PRIu32 " Mbit to %" PRIu 32 " Mbit.", iface, p->limit, speed);
printe(PT_Info); printe(PT_Info);
} }
p->limit = speed; p->limit = speed;
p->retries = 0; p->retries = 0;
p->detected = current; p->detected = current;
skipping to change at line 138 skipping to change at line 144
if (p->limit > 0) { if (p->limit > 0) {
*limit = p->limit; *limit = p->limit;
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
p = p->next; p = p->next;
} }
if (cfg.bwdetection) { if (!istun(iface) && cfg.bwdetection) {
if (ibwadd(iface, (uint32_t)cfg.maxbw)) { if (ibwadd(iface, (uint32_t)cfg.maxbw)) {
p = ibwgetnode(iface); p = ibwgetnode(iface);
if (p != NULL) { if (p != NULL) {
speed = getifspeed(iface); speed = getifspeed(iface);
if (speed > 0) { if (speed > 0) {
p->limit = speed; p->limit = speed;
p->retries = 0; p->retries = 0;
p->detected = current; p->detected = current;
*limit = speed; *limit = speed;
return 1; return 1;
 End of changes. 2 change blocks. 
2 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)