[master] a09c3b46e Revert "Terminate varnishtop -d automatically"
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Jul 4 15:15:09 UTC 2018
commit a09c3b46efb0b22b55c6a6f3c1d27f9edb31269e
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Jul 4 16:14:39 2018 +0200
Revert "Terminate varnishtop -d automatically"
This reverts commit d1b78e8d13a993931d19f2c11acd19959e258ce9.
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
diff --git a/bin/varnishtest/tests/r02686.vtc b/bin/varnishtest/tests/r02686.vtc
index eb85b9914..a58a4f545 100644
--- a/bin/varnishtest/tests/r02686.vtc
+++ b/bin/varnishtest/tests/r02686.vtc
@@ -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
diff --git a/bin/varnishtest/tests/u00004.vtc b/bin/varnishtest/tests/u00004.vtc
index 5435f9865..5dfaa3310 100644
--- a/bin/varnishtest/tests/u00004.vtc
+++ b/bin/varnishtest/tests/u00004.vtc
@@ -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" {
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 9372c5e36..942e25b97 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -76,13 +76,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);
@@ -203,7 +203,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;
@@ -221,8 +221,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));
@@ -240,7 +239,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) {
@@ -252,8 +251,6 @@ update(int p)
}
}
AC(refresh());
- if (eof)
- quit = 1;
}
static void *
More information about the varnish-commit
mailing list