aboutsummaryrefslogtreecommitdiffstats
path: root/signal.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-04 19:18:44 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-04 19:18:44 +0100
commitceccd394200b9152f4df57e5bbe7d7e9002b8704 (patch)
tree877ac749a2bdde2d1455630a211134bbc31edb1b /signal.go
parentMerge branch 'master' into timer-teardown (diff)
downloadwireguard-go-ceccd394200b9152f4df57e5bbe7d7e9002b8704.tar.xz
wireguard-go-ceccd394200b9152f4df57e5bbe7d7e9002b8704.zip
Work on logging format
Diffstat (limited to '')
-rw-r--r--signal.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/signal.go b/signal.go
index 2cefad4..1505593 100644
--- a/signal.go
+++ b/signal.go
@@ -11,6 +11,10 @@ func NewSignal() (s Signal) {
return
}
+func (s *Signal) Close() {
+ close(s.C)
+}
+
func (s *Signal) Disable() {
s.enabled.Set(false)
s.Clear()
@@ -43,7 +47,9 @@ func (s Signal) Clear() {
/* Unblocks all listeners (forever)
*/
func (s Signal) Broadcast() {
- close(s.C)
+ if s.enabled.Get() {
+ close(s.C)
+ }
}
/* Wait for the signal