dnsforward -- flush querylog to file on server stop
This commit is contained in:
parent
e357620740
commit
9b43e07d7f
|
@ -215,6 +215,18 @@ func (s *Server) Stop() error {
|
|||
return errorx.Decorate(err, "Couldn't close UDP listening socket")
|
||||
}
|
||||
}
|
||||
|
||||
// flush remainder to file
|
||||
logBufferLock.Lock()
|
||||
flushBuffer := logBuffer
|
||||
logBuffer = nil
|
||||
logBufferLock.Unlock()
|
||||
err := flushToFile(flushBuffer)
|
||||
if err != nil {
|
||||
log.Printf("Saving querylog to file failed: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue