aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manager
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-12-03 13:40:02 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-12-09 16:01:47 +0100
commit450189162e15c813713b5c3a5208bdb6380c17f8 (patch)
tree40c4d93b70a705f50559a72aac135b6a6129336e /manager
parentmanager: use service subscriptions on win 8+ (diff)
downloadwireguard-windows-450189162e15c813713b5c3a5208bdb6380c17f8.tar.xz
wireguard-windows-450189162e15c813713b5c3a5208bdb6380c17f8.zip
ringlogger: hook into global panic writer
This is a grotesque hack, and hopefully upstream Go will provide a nicer way of doing this, but already it seems quite adept at catching panics. See https://github.com/golang/go/issues/42888 for more info. This requires us to rewrite the ringlogger path to avoid all allocations. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'manager')
-rw-r--r--manager/interfacecleanup.go2
-rw-r--r--manager/ipc_server.go1
-rw-r--r--manager/service.go16
-rw-r--r--manager/tunneltracker.go2
-rw-r--r--manager/updatestate.go2
5 files changed, 0 insertions, 23 deletions
diff --git a/manager/interfacecleanup.go b/manager/interfacecleanup.go
index b6c8d6ae..58ed6615 100644
--- a/manager/interfacecleanup.go
+++ b/manager/interfacecleanup.go
@@ -18,8 +18,6 @@ import (
)
func cleanupStaleWintunInterfaces() {
- defer printPanic()
-
m, err := mgr.Connect()
if err != nil {
return
diff --git a/manager/ipc_server.go b/manager/ipc_server.go
index 94d24e6f..19298016 100644
--- a/manager/ipc_server.go
+++ b/manager/ipc_server.go
@@ -467,7 +467,6 @@ func IPCServerListen(reader *os.File, writer *os.File, events *os.File, elevated
}
go func() {
- defer printPanic()
managerServicesLock.Lock()
managerServices[service] = true
managerServicesLock.Unlock()
diff --git a/manager/service.go b/manager/service.go
index 2afd796f..f439c186 100644
--- a/manager/service.go
+++ b/manager/service.go
@@ -7,12 +7,9 @@ package manager
import (
"errors"
- "fmt"
"log"
"os"
"runtime"
- "runtime/debug"
- "strings"
"sync"
"syscall"
"time"
@@ -30,17 +27,6 @@ import (
type managerService struct{}
-func printPanic() {
- if x := recover(); x != nil {
- for _, line := range append([]string{fmt.Sprint(x)}, strings.Split(string(debug.Stack()), "\n")...) {
- if len(strings.TrimSpace(line)) > 0 {
- log.Println(line)
- }
- }
- panic(x)
- }
-}
-
func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (svcSpecificEC bool, exitCode uint32) {
changes <- svc.Status{State: svc.StartPending}
@@ -61,7 +47,6 @@ func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest
serviceError = services.ErrorRingloggerOpen
return
}
- defer printPanic()
log.Println("Starting", version.UserAgent())
@@ -268,7 +253,6 @@ func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest
goStartProcess := func(session uint32) {
procsGroup.Add(1)
go func() {
- defer printPanic()
startProcess(session)
procsGroup.Done()
}()
diff --git a/manager/tunneltracker.go b/manager/tunneltracker.go
index 6d376e4a..cfd28693 100644
--- a/manager/tunneltracker.go
+++ b/manager/tunneltracker.go
@@ -196,8 +196,6 @@ func trackService(service *mgr.Service, callback func(status uint32) bool) error
}
func trackTunnelService(tunnelName string, service *mgr.Service) {
- defer printPanic()
-
defer func() {
service.Close()
log.Printf("[%s] Tunnel service tracker finished", tunnelName)
diff --git a/manager/updatestate.go b/manager/updatestate.go
index 9686e92f..e926e63d 100644
--- a/manager/updatestate.go
+++ b/manager/updatestate.go
@@ -24,8 +24,6 @@ const (
var updateState = UpdateStateUnknown
func checkForUpdates() {
- defer printPanic()
-
if !version.IsRunningOfficialVersion() {
log.Println("Build is not official, so updates are disabled")
updateState = UpdateStateUpdatesDisabledUnofficialBuild