Simplify screen refresh logic by removing tricky delay
logic which freezes a little key pressing.

Signed-off-by: Vadim Kochan <vadi...@gmail.com>
---
 flowtop.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/flowtop.c b/flowtop.c
index 3060917..2077fdb 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1278,8 +1278,6 @@ static void flows_table_init(struct ui_table *tbl)
 
 static void presenter(void)
 {
-       int time_sleep_us = 200000;
-       int time_passed_us = 0;
        bool show_help = false;
        int skip_lines = 0;
        WINDOW *screen;
@@ -1299,7 +1297,6 @@ static void presenter(void)
 
        rcu_register_thread();
        while (!sigint) {
-               bool redraw_flows = true;
                int ch;
 
                curs_set(0);
@@ -1351,31 +1348,19 @@ static void presenter(void)
                        break;
                default:
                        fflush(stdin);
-                       redraw_flows = false;
                        break;
                }
 
                draw_header(screen);
 
-               if (!redraw_flows)
-                       redraw_flows = time_passed_us >= 1 * USEC_PER_SEC;
-
-               if (show_help)
-                       redraw_flows = false;
-
-               if (redraw_flows) {
-                       draw_flows(screen, &flow_list, skip_lines);
-                       time_passed_us = 0;
-               } else {
-                       time_passed_us += time_sleep_us;
-               }
-
                if (show_help)
                        draw_help(screen);
+               else
+                       draw_flows(screen, &flow_list, skip_lines);
 
                draw_footer(screen);
 
-               usleep(time_sleep_us);
+               usleep(80000);
        }
        rcu_unregister_thread();
 
-- 
2.6.3

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to