From 2583d40c80039504e320cb23e72fbe163968975b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 29 Mar 2018 15:18:19 +0200 Subject: Retry Bro connection instead of quitting on failure --- src/broevent.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/broevent.c b/src/broevent.c index 8e7ded9..ab76d09 100644 --- a/src/broevent.c +++ b/src/broevent.c @@ -22,6 +22,8 @@ * SOFTWARE. */ +#include + #include "fifoqueue.h" #include "broevent.h" #ifdef BROCCOLI @@ -82,11 +84,11 @@ bro_event_listener(void * args) bro_event_registry_add(bc, "modbus_register_received", (BroEventFunc) modbus_register_received, NULL); - if (! bro_conn_connect(bc)) + while (! bro_conn_connect(bc)) { - printf("Could not connect to Bro at %s:%s.\n", host_default, - port_default); - exit(-1); + printf("Could not connect to Bro at %s:%s. Retrying in one second.\n", + host_default, port_default); + sleep(1); } fd =bro_conn_get_fd(bc); -- cgit v1.2.3