Skip to content

Commit c7b475b

Browse files
authored
Allow manual reload via SIGHUP regardless of hot-reload enablement
Potential fix for #2876 as per my suggestion in #2876 (comment). I'm not currently in a position to test this, just relying on it looking safe to move these lines around without unwanted side-effects.
1 parent 2d099e2 commit c7b475b

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

dnscrypt-proxy/hot_reload.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ import (
1010

1111
// InitHotReload sets up hot-reloading for configuration files
1212
func (proxy *Proxy) InitHotReload() error {
13-
// Check if hot reload is enabled
14-
if !proxy.enableHotReload {
15-
dlog.Notice("Hot reload is disabled")
16-
return nil
17-
}
18-
19-
dlog.Notice("Hot reload is enabled")
20-
21-
// Create a new configuration watcher
22-
configWatcher := NewConfigWatcher(1000) // Check every second
23-
2413
// Find plugins that support hot-reloading
2514
plugins := []Plugin{}
2615

@@ -40,6 +29,20 @@ func (proxy *Proxy) InitHotReload() error {
4029
}
4130
proxy.pluginsGlobals.RUnlock()
4231

32+
// Setup SIGHUP handler for manual reload
33+
setupSignalHandler(proxy, plugins)
34+
35+
// Check if hot reload is enabled
36+
if !proxy.enableHotReload {
37+
dlog.Notice("Hot reload is disabled")
38+
return nil
39+
}
40+
41+
dlog.Notice("Hot reload is enabled")
42+
43+
// Create a new configuration watcher
44+
configWatcher := NewConfigWatcher(1000) // Check every second
45+
4346
// Register plugins for config watching
4447
for _, plugin := range plugins {
4548
switch p := plugin.(type) {
@@ -100,9 +103,6 @@ func (proxy *Proxy) InitHotReload() error {
100103
}
101104
}
102105

103-
// Setup SIGHUP handler for manual reload
104-
setupSignalHandler(proxy, plugins)
105-
106106
return nil
107107
}
108108

0 commit comments

Comments
 (0)