summaryrefslogtreecommitdiff
path: root/modules/caddytls/sessiontickets.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-05-12 11:36:20 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-05-12 11:36:20 -0600
commitaef560c7fc52092a412d9e97112b8cb879c5eda5 (patch)
tree905fce22478842dd8a8d07a65c8769e7db1c4cad /modules/caddytls/sessiontickets.go
parent44536a7594f060dfca54a3cfb36135c93cba8e59 (diff)
all: Recover from panics in goroutines
Diffstat (limited to 'modules/caddytls/sessiontickets.go')
-rw-r--r--modules/caddytls/sessiontickets.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/caddytls/sessiontickets.go b/modules/caddytls/sessiontickets.go
index 258c135..bfc5628 100644
--- a/modules/caddytls/sessiontickets.go
+++ b/modules/caddytls/sessiontickets.go
@@ -20,6 +20,8 @@ import (
"encoding/json"
"fmt"
"io"
+ "log"
+ "runtime/debug"
"sync"
"time"
@@ -118,6 +120,12 @@ func (s *SessionTicketService) start() error {
// the keys whenever new ones are sent. It reads
// from keysChan until s.stop() is called.
func (s *SessionTicketService) stayUpdated() {
+ defer func() {
+ if err := recover(); err != nil {
+ log.Printf("[PANIC] session ticket service: %v\n%s", err, debug.Stack())
+ }
+ }()
+
// this call is essential when Initialize()
// returns without error, because the stop
// channel is the only way the key source