Skip to content

Commit

Permalink
Reduce code duplication in signals handler
Browse files Browse the repository at this point in the history
  • Loading branch information
csstaub committed Feb 17, 2018
1 parent bc6c960 commit a1b02b8
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions signals.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,20 @@ func (context *Context) signalHandler(proxy *proxy, closeables []io.Closer) {
return
} else {
logger.Printf("received %s, reloading certificates", sig.String())
context.status.Reloading()
err := context.cert.reload()
if err != nil {
logger.Printf("error reloading certificates: %s", err)
}
logger.Printf("reloading complete")
context.status.Listening()
context.reload()
}
case <-context.watcher:
context.status.Reloading()
err := context.cert.reload()
if err != nil {
logger.Printf("error reloading certificates: %s", err)
}
logger.Printf("reloading complete")
context.status.Listening()
context.reload()
}
}
}

func (context *Context) reload() {
context.status.Reloading()
err := context.cert.reload()
if err != nil {
logger.Printf("error reloading certificates: %s", err)
}
logger.Printf("reloading complete")
context.status.Listening()
}

0 comments on commit a1b02b8

Please sign in to comment.