summaryrefslogtreecommitdiff
path: root/src/nshd/hackers_git/hackers.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-12 09:14:40 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-12 09:14:40 -0600
commitb190157b8c568922f7f9b4039b67a34862fa9f54 (patch)
tree41890a5470e013c31e89d00fe6a134434f3417d4 /src/nshd/hackers_git/hackers.go
parenta71e76c9ab160f0ab7abbfe6db500b3b178e57de (diff)
Add an inotify watcher utility using channels; use it.
The interface of inotify/inutil.Watcher more resembles golang.org/x/exp/inotify; with it using channels instead of repeated calls to Read(). In my use-case, this is useful because it allows implementing a "read" (select, really) that doesn't block Close(); which is required to handle the TERM signal correctly.
Diffstat (limited to 'src/nshd/hackers_git/hackers.go')
-rw-r--r--src/nshd/hackers_git/hackers.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nshd/hackers_git/hackers.go b/src/nshd/hackers_git/hackers.go
index 446351d..f47868f 100644
--- a/src/nshd/hackers_git/hackers.go
+++ b/src/nshd/hackers_git/hackers.go
@@ -2,11 +2,11 @@ package hackers_git
import (
"inotify"
+ "inotify/inutil"
"nslcd_proto"
"nslcd_proto/util"
"nslcd_systemd"
"sd_daemon/logger"
- "sd_daemon/lsb"
"sync"
)
@@ -24,11 +24,12 @@ type Hackers struct {
util.NullBackend
Cfg Config
lock sync.RWMutex
+ workers sync.WaitGroup
users map[int32]user
groups map[string]map[string]bool
- in_fd *inotify.Inotify
+ in_fd *inutil.Watcher
in_wd_home inotify.Wd
in_wd_yaml inotify.Wd
in_uid2wd map[int32]inotify.Wd
@@ -44,10 +45,6 @@ func (o *Hackers) Init() error {
logger.Err("Could not initialize hackers.git: %v", err)
return err
}
- go func() {
- defer lsb.Recover()
- o.worker()
- }()
return nil
}