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