fix: ensure doh connections are closed when it is disabled

This commit is contained in:
James Houlahan
2020-06-17 10:52:53 +02:00
parent 9241a9bdbf
commit 02804d067c
7 changed files with 33 additions and 6 deletions

View File

@ -53,6 +53,12 @@ func New(
clientManager users.ClientManager,
credStorer users.CredentialsStorer,
) *Bridge {
// Allow DoH before starting the app if the user has previously set this setting.
// This allows us to start even if protonmail is blocked.
if pref.GetBool(preferences.AllowProxyKey) {
clientManager.AllowProxy()
}
storeFactory := newStoreFactory(config, panicHandler, clientManager, eventListener)
u := users.New(config, panicHandler, eventListener, clientManager, credStorer, storeFactory)
b := &Bridge{
@ -62,12 +68,6 @@ func New(
clientManager: clientManager,
}
// Allow DoH before starting the app if the user has previously set this setting.
// This allows us to start even if protonmail is blocked.
if pref.GetBool(preferences.AllowProxyKey) {
b.AllowProxy()
}
if pref.GetBool(preferences.FirstStartKey) {
b.SendMetric(metrics.New(metrics.Setup, metrics.FirstStart, metrics.Label(config.GetVersion())))
}