Commit 181fed08 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Prevent a segfault on varnish reconnect in the varnishstat hitrate

implementation
parent 429966cd
......@@ -414,7 +414,7 @@ sample_hitrate(void)
double hr, mr, ratio;
uint64_t hit, miss;
if (VSC_C_mgt == NULL)
if (VSC_C_main == NULL)
return;
tv = VTIM_mono();
......@@ -548,17 +548,8 @@ draw_status(void)
werase(w_status);
if (VSC_C_mgt != NULL) {
if (VSC_C_mgt != NULL)
up_mgt = VSC_C_mgt->uptime;
if( COLS > 70) {
mvwprintw(w_status, 0, (getmaxx (w_status) - 37),
"Hitrate n: %8u %8u %8u", hitrate.hr_10.n, hitrate.hr_100.n,
hitrate.hr_1000.n);
mvwprintw(w_status, 1, (getmaxx (w_status) - 37),
" avg(n): %8.4f %8.4f %8.4f", hitrate.hr_10.acc,
hitrate.hr_100.acc, hitrate.hr_1000.acc);
}
}
if (VSC_C_main != NULL)
up_chld = VSC_C_main->uptime;
......@@ -571,6 +562,14 @@ draw_status(void)
if (VSC_C_mgt == NULL)
mvwprintw(w_status, 0, COLS - strlen(discon), discon);
else if (COLS > 70) {
mvwprintw(w_status, 0, getmaxx(w_status) - 37,
"Hitrate n: %8u %8u %8u", hitrate.hr_10.n, hitrate.hr_100.n,
hitrate.hr_1000.n);
mvwprintw(w_status, 1, getmaxx(w_status) - 37,
" avg(n): %8.4f %8.4f %8.4f", hitrate.hr_10.acc,
hitrate.hr_100.acc, hitrate.hr_1000.acc);
}
wnoutrefresh(w_status);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment