aboutsummaryrefslogtreecommitdiffstats
path: root/lib/socket.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socket.go')
-rw-r--r--lib/socket.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/socket.go b/lib/socket.go
index 814dce12..ae1ce339 100644
--- a/lib/socket.go
+++ b/lib/socket.go
@@ -13,6 +13,7 @@ import (
"sync/atomic"
"time"
+ "git.sr.ht/~rjarry/aerc/logging"
"github.com/kyoh86/xdg"
)
@@ -36,6 +37,8 @@ func StartServer(logger *log.Logger) (*AercServer, error) {
}
// TODO: stash clients and close them on exit... bleh racey
go func() {
+ defer logging.PanicHandler()
+
for {
conn, err := l.Accept()
if err != nil {
@@ -44,7 +47,11 @@ func StartServer(logger *log.Logger) (*AercServer, error) {
as.logger.Printf("Closing Unix server: %v", err)
return
}
- go as.handleClient(conn)
+ go func() {
+ defer logging.PanicHandler()
+
+ as.handleClient(conn)
+ }()
}
}()
return as, nil