summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nslcd_systemd/nslcd_systemd.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/nslcd_systemd/nslcd_systemd.go b/nslcd_systemd/nslcd_systemd.go
index f7936cb..97991c8 100644
--- a/nslcd_systemd/nslcd_systemd.go
+++ b/nslcd_systemd/nslcd_systemd.go
@@ -130,7 +130,7 @@ func Main(backend Backend) uint8 {
return sd_daemon.EXIT_NOTRUNNING
}
defer func() { socket.(*net.UnixListener).SetDeadline(time.Now()) }()
- sock := make(chan *net.UnixConn)
+
socket_error := make(chan error)
wg.Add(1)
go func() {
@@ -161,7 +161,12 @@ func Main(backend Backend) uint8 {
}
}
if conn != nil {
- sock <- conn.(*net.UnixConn)
+ wg.Add(1)
+ go func() {
+ defer sd_daemon.Recover()
+ defer wg.Done()
+ handler(conn.(*net.UnixConn), backend)
+ }()
}
}
}()
@@ -188,13 +193,6 @@ func Main(backend Backend) uint8 {
case err = <-socket_error:
sd_daemon.Log.Err(fmt.Sprintf("%v", err))
return sd_daemon.EXIT_FAILURE
- case conn := <-sock:
- wg.Add(1)
- go func() {
- defer sd_daemon.Recover()
- defer wg.Done()
- handler(conn, backend)
- }()
}
}
}