summaryrefslogtreecommitdiff
path: root/modules/caddytls/standardstek
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/standardstek
parent44536a7594f060dfca54a3cfb36135c93cba8e59 (diff)
all: Recover from panics in goroutines
Diffstat (limited to 'modules/caddytls/standardstek')
-rw-r--r--modules/caddytls/standardstek/stek.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddytls/standardstek/stek.go b/modules/caddytls/standardstek/stek.go
index eb609ca..61cab0e 100644
--- a/modules/caddytls/standardstek/stek.go
+++ b/modules/caddytls/standardstek/stek.go
@@ -16,6 +16,7 @@ package standardstek
import (
"log"
+ "runtime/debug"
"sync"
"time"
@@ -81,6 +82,11 @@ func (s *standardSTEKProvider) Next(doneChan <-chan struct{}) <-chan [][32]byte
// rotate rotates keys on a regular basis, sending each updated set of
// keys down keysChan, until doneChan is closed.
func (s *standardSTEKProvider) rotate(doneChan <-chan struct{}, keysChan chan<- [][32]byte) {
+ defer func() {
+ if err := recover(); err != nil {
+ log.Printf("[PANIC] standard STEK rotation: %v\n%s", err, debug.Stack())
+ }
+ }()
for {
select {
case now := <-s.timer.C: