mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-24 07:55:06 +03:00
Remove sendRestartSignal function from WebUIServer as it is no longer needed for cross-platform restart handling. Clean up code by eliminating unused imports and comments related to platform-specific signal handling.
This commit is contained in:
parent
8d0cbfd0ad
commit
82b681367e
3 changed files with 29 additions and 17 deletions
|
@ -9,10 +9,8 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
||||
|
@ -609,18 +607,3 @@ func (w *WebUIServer) restartServer() {
|
|||
w.log.Infof("Please restart Yggdrasil manually to apply configuration changes")
|
||||
}
|
||||
}
|
||||
|
||||
// sendRestartSignal sends a restart signal to the process in a cross-platform way
|
||||
func sendRestartSignal(proc *os.Process) error {
|
||||
// Platform-specific signal handling
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
// Windows doesn't support SIGUSR1, so we'll use a different approach
|
||||
// For now, we'll just log that manual restart is needed
|
||||
// In the future, this could be enhanced with Windows-specific restart mechanisms
|
||||
return fmt.Errorf("automatic restart not supported on Windows")
|
||||
default:
|
||||
// Unix-like systems support SIGUSR1
|
||||
return proc.Signal(syscall.SIGUSR1)
|
||||
}
|
||||
}
|
||||
|
|
13
src/webui/server_unix.go
Normal file
13
src/webui/server_unix.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
//go:build !windows
|
||||
|
||||
package webui
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// sendRestartSignal sends a restart signal to the process on Unix-like systems
|
||||
func sendRestartSignal(proc *os.Process) error {
|
||||
return proc.Signal(syscall.SIGUSR1)
|
||||
}
|
16
src/webui/server_windows.go
Normal file
16
src/webui/server_windows.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
//go:build windows
|
||||
|
||||
package webui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// sendRestartSignal sends a restart signal to the process on Windows
|
||||
func sendRestartSignal(proc *os.Process) error {
|
||||
// Windows doesn't support SIGUSR1, so we'll use a different approach
|
||||
// For now, we'll just log that manual restart is needed
|
||||
// In the future, this could be enhanced with Windows-specific restart mechanisms
|
||||
return fmt.Errorf("automatic restart not supported on Windows")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue