Commit a09c3b46 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Revert "Terminate varnishtop -d automatically"

This reverts commit d1b78e8d.

The problem is that upon exiting the screen is likely to be cleared on
most terminals (not the one we embed in varnishtest for example) so it
doesn't give any chance to the user to read the output.

The consensus is to restore the previous behavior and fix the manual
instead.

Conflicts:
	bin/varnishtest/tests/u00004.vtc
	bin/varnishtop/varnishtop.c

Breaks:
	bin/varnishtest/tests/r02686.vtc

Refs #2721
parent 2efb4633
...@@ -18,7 +18,7 @@ delay 2 ...@@ -18,7 +18,7 @@ delay 2
process p1 -expect-text 1 1 "list length 1" process p1 -expect-text 1 1 "list length 1"
process p1 -expect-text 1 75 "(EOF)" process p1 -expect-text 1 75 "(EOF)"
process p1 -expect-text 3 6 "1.00 ReqMethod GET" process p1 -expect-text 3 6 "1.00 ReqMethod GET"
process p1 -screen_dump -wait process p1 -screen_dump -write q -wait
process p2 -dump {varnishtop -n ${v1_name} -1 -i ReqMethod} -start process p2 -dump {varnishtop -n ${v1_name} -1 -i ReqMethod} -start
process p2 -winsz 30 80 process p2 -winsz 30 80
......
...@@ -14,8 +14,10 @@ client c1 { ...@@ -14,8 +14,10 @@ client c1 {
shell -expect "fetch" "varnishtop -n ${v1_name} -1" shell -expect "fetch" "varnishtop -n ${v1_name} -1"
process p1 "varnishtop -n ${v1_name} -d" -run -screen_dump process p1 "varnishtop -n ${v1_name} -d" -start
process p1 -expect-text 0 0 fetch delay 1
process p1 -screen_dump -expect-text 0 0 fetch
process p1 -write q -wait
# without -f # without -f
shell -match "1\\.00 RespHeader Date: [^\\n]+\\n" { shell -match "1\\.00 RespHeader Date: [^\\n]+\\n" {
......
...@@ -76,13 +76,13 @@ struct top { ...@@ -76,13 +76,13 @@ struct top {
}; };
static int period = 60; /* seconds */ static int period = 60; /* seconds */
static int end_of_file = 0;
static unsigned ntop; static unsigned ntop;
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
static int f_flag = 0; static int f_flag = 0;
static unsigned maxfieldlen = 0; static unsigned maxfieldlen = 0;
static const char *ident; static const char *ident;
static volatile sig_atomic_t end_of_file = 0;
static volatile sig_atomic_t quit = 0; static volatile sig_atomic_t quit = 0;
static VRB_HEAD(t_order, top) h_order = VRB_INITIALIZER(&h_order); static VRB_HEAD(t_order, top) h_order = VRB_INITIALIZER(&h_order);
...@@ -203,7 +203,7 @@ static void ...@@ -203,7 +203,7 @@ static void
update(int p) update(int p)
{ {
struct top *tp, *tp2; struct top *tp, *tp2;
int l, len, eof; int l, len;
double t = 0; double t = 0;
static time_t last = 0; static time_t last = 0;
static unsigned n = 0; static unsigned n = 0;
...@@ -221,8 +221,7 @@ update(int p) ...@@ -221,8 +221,7 @@ update(int p)
AC(erase()); AC(erase());
q = ident; q = ident;
len = COLS - strlen(q); len = COLS - strlen(q);
eof = end_of_file; if (end_of_file)
if (eof)
AC(mvprintw(0, len - (1 + 6), "%s (EOF)", q)); AC(mvprintw(0, len - (1 + 6), "%s (EOF)", q));
else else
AC(mvprintw(0, len - 1, "%s", q)); AC(mvprintw(0, len - 1, "%s", q));
...@@ -240,7 +239,7 @@ update(int p) ...@@ -240,7 +239,7 @@ update(int p)
len, len, tp->rec_data)); len, len, tp->rec_data));
t = tp->count; t = tp->count;
} }
if (eof) if (end_of_file)
continue; continue;
tp->count += (1.0/3.0 - tp->count) / (double)n; tp->count += (1.0/3.0 - tp->count) / (double)n;
if (tp->count * 10 < t || l > LINES * 10) { if (tp->count * 10 < t || l > LINES * 10) {
...@@ -252,8 +251,6 @@ update(int p) ...@@ -252,8 +251,6 @@ update(int p)
} }
} }
AC(refresh()); AC(refresh());
if (eof)
quit = 1;
} }
static void * static void *
......
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