Skip to content

Commit 7ebe361

Browse files
authored
unbound: wait for a pipe a bit (#6331)
1 parent 8cb5ec0 commit 7ebe361

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/opnsense/scripts/unbound/logger.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,22 @@ def run_logger(self):
185185

186186
self._setup_db()
187187

188-
try:
189-
# open() will block until a query has been pushed down the fifo
190-
self.fd = open(self.target_pipe, 'r')
191-
except InterruptedError:
192-
self.close_logger()
193-
except OSError:
194-
syslog.syslog(syslog.LOG_ERR, "Unable to open pipe. This is likely because Unbound isn't running.")
195-
sys.exit(1)
188+
r_count = 0
189+
pipe_ready = False
190+
# give dnsbl_module.py some time to create a pipe
191+
while r_count < 3 and not pipe_ready:
192+
try:
193+
# open() will block until a query has been pushed down the fifo
194+
self.fd = open(self.target_pipe, 'r')
195+
pipe_ready = True
196+
except InterruptedError:
197+
self.close_logger()
198+
except OSError:
199+
r_count =+ 1
200+
if r_count == 3:
201+
syslog.syslog(syslog.LOG_ERR, "Unable to open pipe. This is likely because Unbound isn't running.")
202+
sys.exit(1)
203+
time.sleep(1)
196204

197205
self.selector.register(self.fd.fileno(), selectors.EVENT_READ, self._read)
198206

0 commit comments

Comments
 (0)