Skip to content

Commit

Permalink
noot
Browse files Browse the repository at this point in the history
  • Loading branch information
elee1766 committed Jun 20, 2024
1 parent 3f1ff11 commit 561a6e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/caddytls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"runtime/debug"
"sync"
"time"
"unsafe"

"github.com/caddyserver/certmagic"
"go.uber.org/zap"
Expand Down Expand Up @@ -146,7 +147,9 @@ func (t *TLS) Provision(ctx caddy.Context) error {
certCacheMu.Lock()
if certCache == nil {
certCache = certmagic.NewCache(cacheOpts)
fmt.Println("creating cert cache", unsafe.Pointer(certCache))
} else {
fmt.Println("reusing cert cache", unsafe.Pointer(certCache))
certCache.SetOptions(cacheOpts)
}
certCacheMu.Unlock()
Expand Down Expand Up @@ -356,6 +359,7 @@ func (t *TLS) Stop() error {

// Cleanup frees up resources allocated during Provision.
func (t *TLS) Cleanup() error {
fmt.Println("cleanup called cert cache", unsafe.Pointer(certCache))
// stop the session ticket rotation goroutine
if t.SessionTickets != nil {
t.SessionTickets.stop()
Expand Down Expand Up @@ -401,6 +405,7 @@ func (t *TLS) Cleanup() error {

// remove the certs
certCacheMu.RLock()
fmt.Println("washing cert cache", unsafe.Pointer(certCache))
certCache.RemoveManaged(noLongerManaged)
certCache.Remove(noLongerLoaded)
certCacheMu.RUnlock()
Expand All @@ -417,6 +422,7 @@ func (t *TLS) Cleanup() error {
certCache.Stop()
certCacheMu.Lock()
certCache = nil
fmt.Println("deleting cert cache", unsafe.Pointer(certCache))
certCacheMu.Unlock()
}

Expand Down

0 comments on commit 561a6e3

Please sign in to comment.