diff options
author | Robin Krahl <me@robin-krahl.de> | 2018-03-29 15:18:19 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2018-03-29 15:18:19 +0200 |
commit | 2583d40c80039504e320cb23e72fbe163968975b (patch) | |
tree | 43622dc1e04bd3592bb6d63668c4ff37e8f8704d /src | |
parent | 9a3560ba07404cbf7ff1c4923ef3a54a8f1be552 (diff) | |
download | midbro-2583d40c80039504e320cb23e72fbe163968975b.tar.gz midbro-2583d40c80039504e320cb23e72fbe163968975b.tar.bz2 |
Retry Bro connection instead of quitting on failure
Diffstat (limited to 'src')
-rw-r--r-- | src/broevent.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 <unistd.h> + #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); |