summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index 94fb313..6f7c4c2 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -115,8 +115,19 @@ static void signal_handler(int number)
static void timer_elapsed(int unused)
{
+ int ret;
+
set_itimer_interval_value(&itimer, 0, interval);
- pull_and_flush_tx_ring(tx_sock);
+
+ ret = pull_and_flush_tx_ring(tx_sock);
+ if (unlikely(ret < 0)) {
+ /* We could hit EBADF if the socket has been closed before
+ * the timer was triggered.
+ */
+ if (errno != EBADF && errno != ENOBUFS)
+ panic("Flushing TX_RING failed: %s!\n", strerror(errno));
+ }
+
setitimer(ITIMER_REAL, &itimer, NULL);
}