Simplify dump & flows refreshing via one nfct handle, which is enough.

Signed-off-by: Vadim Kochan <vadi...@gmail.com>
---
 flowtop.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/flowtop.c b/flowtop.c
index cc5ffa2..4c15c06 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1615,7 +1615,6 @@ static void collector_dump_flows(void)
 
 static void *collector(void *null __maybe_unused)
 {
-       struct nfct_handle *ct_update;
        struct nfct_handle *ct_event;
        struct pollfd poll_fd[1];
 
@@ -1631,12 +1630,6 @@ static void *collector(void *null __maybe_unused)
 
        nfct_callback_register(ct_event, NFCT_T_ALL, flow_event_cb, NULL);
 
-       ct_update = nfct_open(CONNTRACK, NF_NETLINK_CONNTRACK_UPDATE);
-       if (!ct_update)
-               panic("Cannot create a nfct handle: %s\n", strerror(errno));
-
-       nfct_callback_register(ct_update, NFCT_T_ALL, flow_event_cb, NULL);
-
        poll_fd[0].fd = nfct_fd(ct_event);
        poll_fd[0].events = POLLIN;
 
@@ -1644,10 +1637,6 @@ static void *collector(void *null __maybe_unused)
                panic("Cannot set non-blocking socket: fcntl(): %s\n",
                      strerror(errno));
 
-       if (fcntl(nfct_fd(ct_update), F_SETFL, O_NONBLOCK) == -1)
-               panic("Cannot set non-blocking socket: fcntl(): %s\n",
-                     strerror(errno));
-
        rcu_register_thread();
 
        collector_dump_flows();
@@ -1666,7 +1655,7 @@ static void *collector(void *null __maybe_unused)
                        collector_dump_flows();
                }
 
-               collector_refresh_flows(ct_update);
+               collector_refresh_flows(ct_event);
 
                status = poll(poll_fd, 1, 0);
                if (status < 0) {
@@ -1688,7 +1677,6 @@ static void *collector(void *null __maybe_unused)
        spinlock_destroy(&flow_list.lock);
 
        nfct_close(ct_event);
-       nfct_close(ct_update);
 
        pthread_exit(NULL);
 }
-- 
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