- dns query log: robust file flushing mechanism

Before this patch we could exit the process without waiting for
 file writing task to complete.
As a result a file could become corrupted or a large chunk of data
 could be missing.

Now the main thread either waits until file writing task completes
 or it writes log buffer to file itself.
This commit is contained in:
Simon Zolin
2019-05-15 13:11:36 +03:00
parent 0f28a989e9
commit d5f6dd1a46
3 changed files with 21 additions and 13 deletions

View File

@@ -236,7 +236,7 @@ func (s *Server) stopInternal() error {
}
// flush remainder to file
return s.queryLog.flushLogBuffer()
return s.queryLog.flushLogBuffer(true)
}
// IsRunning returns true if the DNS server is running