Skip to content

Commit

Permalink
BlockedZoneManager: added retry mechanism for delayed save.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShreyasZare committed Jun 1, 2024
1 parent 2a05c7a commit f050deb
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions DnsServerCore/Dns/ZoneManagers/BlockedZoneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,20 @@ public BlockedZoneManager(DnsServer dnsServer)
{
lock (_saveLock)
{
try
{
SaveZoneFileInternal();
}
catch (Exception ex)
{
_dnsServer.LogManager.Write(ex);
}
finally
if (_pendingSave)
{
_pendingSave = false;
try
{
SaveZoneFileInternal();
_pendingSave = false;
}
catch (Exception ex)
{
_dnsServer.LogManager.Write(ex);

//set timer to retry again
_saveTimer.Change(SAVE_TIMER_INITIAL_INTERVAL, Timeout.Infinite);
}
}
}
});
Expand All @@ -88,10 +91,10 @@ public void Dispose()
if (_disposed)
return;

_saveTimer?.Dispose();

lock (_saveLock)
{
_saveTimer?.Dispose();

if (_pendingSave)
{
try
Expand Down

0 comments on commit f050deb

Please sign in to comment.