Skip to content

Commit 61c0ff5

Browse files
committed
Fix query log
1 parent 110a7bf commit 61c0ff5

4 files changed

Lines changed: 21 additions & 12 deletions

File tree

SimpleDnsCrypt/ViewModels/AddressBlockLogViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public bool IsAddressBlockLogLogging
8383
}
8484
}
8585

86-
private async void AddressBlockLog(DnscryptProxyConfiguration dnscryptProxyConfiguration)
86+
private void AddressBlockLog(DnscryptProxyConfiguration dnscryptProxyConfiguration)
8787
{
8888

8989
}

SimpleDnsCrypt/ViewModels/MainViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,12 @@ public void Initialize()
110110
{
111111
_isDnsCryptAutomaticModeEnabled = false;
112112
}
113-
}
114113

114+
if (!string.IsNullOrEmpty(DnscryptProxyConfiguration?.query_log?.file))
115+
{
116+
QueryLogViewModel.IsQueryLogLogging = true;
117+
}
118+
}
115119

116120
public bool IsDnsCryptAutomaticModeEnabled
117121
{

SimpleDnsCrypt/ViewModels/QueryLogViewModel.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ namespace SimpleDnsCrypt.ViewModels
1414
[Export(typeof(QueryLogViewModel))]
1515
public class QueryLogViewModel : Screen
1616
{
17+
private static readonly ILog Log = LogManagerHelper.Factory();
1718
private readonly IWindowManager _windowManager;
1819
private readonly IEventAggregator _events;
1920

20-
2121
private ObservableCollection<QueryLogLine> _queryLogLines;
2222
private string _queryLogFile;
2323
private bool _isQueryLogLogging;
2424
private QueryLogLine _selectedQueryLogLine;
2525

26-
27-
2826
[ImportingConstructor]
2927
public QueryLogViewModel(IWindowManager windowManager, IEventAggregator events)
3028
{
@@ -196,17 +194,27 @@ await Task.Run(() =>
196194
}
197195
}).ConfigureAwait(false);
198196
else
199-
IsQueryLogLogging = false;
197+
_isQueryLogLogging = false;
200198
else
201-
IsQueryLogLogging = false;
199+
_isQueryLogLogging = false;
202200
}
203201
else
204202
{
203+
//disable query log again
204+
_isQueryLogLogging = false;
205+
if (DnsCryptProxyManager.IsDnsCryptProxyRunning())
206+
{
207+
dnscryptProxyConfiguration.query_log.file = null;
208+
DnsCryptProxyManager.Restart();
209+
await Task.Delay(Global.ServiceRestartTime).ConfigureAwait(false);
210+
}
205211
Execute.OnUIThread(() => { QueryLogLines.Clear(); });
212+
Execute.OnUIThread(() => { QueryLogFile = string.Empty; });
206213
}
207214
}
208-
catch (Exception)
215+
catch (Exception exception)
209216
{
217+
Log.Error(exception);
210218
}
211219
}
212220
}

SimpleDnsCrypt/Views/MainView.xaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,7 @@
136136
<RowDefinition Height="Auto" />
137137
<RowDefinition Height="*" />
138138
</Grid.RowDefinitions>
139-
<TextBlock Grid.Row="0" Foreground="DarkOrange" FontWeight="Bold"
140-
FontSize="18">
141-
Warning: Pre-Release! :)
142-
</TextBlock>
139+
143140
<Button x:Name="SaveDnsCryptConfiguration" Grid.Row="1" Height="32"
144141
Width="Auto"
145142
VerticalAlignment="Bottom" HorizontalAlignment="Right"

0 commit comments

Comments
 (0)