From 14b99fac2a02b81fbe7b9ddc9fb708cba054bf35 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 6 May 2015 19:39:44 +0100 Subject: [PATCH] minor refactors --- common/signals.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common/signals.go b/common/signals.go index 067bf340..fdc49119 100644 --- a/common/signals.go +++ b/common/signals.go @@ -8,18 +8,17 @@ import ( ) // A subsystem/server/... that can be stopped or queried about the status with a signal -type SignalsReceiver interface { - Status() string +type SignalReceiver interface { Stop() error + Status() string } -func SignalHandlerLoop(ss ...SignalsReceiver) { +func SignalHandlerLoop(ss ...SignalReceiver) { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGUSR1) buf := make([]byte, 1<<20) for { - sig := <-sigs - switch sig { + switch <-sigs { case syscall.SIGINT: Info.Printf("=== received SIGINT ===\n*** exiting\n") for _, subsystem := range ss {