summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnslcd_server/func_handlerequest.go.gen37
1 files changed, 15 insertions, 22 deletions
diff --git a/nslcd_server/func_handlerequest.go.gen b/nslcd_server/func_handlerequest.go.gen
index 40e00c0..d34db88 100755
--- a/nslcd_server/func_handlerequest.go.gen
+++ b/nslcd_server/func_handlerequest.go.gen
@@ -53,20 +53,15 @@ func HandleRequest(backend Backend, in io.Reader, out io.Writer, cred unix.Ucred
}
}
}()
- handleRequest(backend, in, out, cred)
- return
-}
-func handleRequest(backend Backend, in io.Reader, out io.Writer, cred unix.Ucred) {
var version int32
maybePanic(p.Read(in, &version))
if version != p.NSLCD_VERSION {
- panic(p.NslcdError(fmt.Sprintf("Version mismatch: server=%#08x client=%#08x", p.NSLCD_VERSION, version)))
+ return p.NslcdError(fmt.Sprintf("Version mismatch: server=%#08x client=%#08x", p.NSLCD_VERSION, version))
}
var action int32
maybePanic(p.Read(in, &action))
- ch := make(chan interface{})
switch action {
$(
while read -r request; do
@@ -99,27 +94,25 @@ while read -r request; do
;;
esac
)
- _ch := backend.${request}(cred, req)
- go func() {
- defer close(ch)
- for obj := range _ch {
- ch <- obj
+ maybePanic(p.Write(out, p.NSLCD_VERSION))
+ maybePanic(p.Write(out, action))
+ ch := backend.${request}(cred, req)
+ for result := range ch {
+ if err == nil {
+ err = p.Write(out, p.NSLCD_RESULT_BEGIN)
+ }
+ if err == nil {
+ err = p.Write(out, result)
}
- }()
+ }
+ maybePanic(err)
+ maybePanic(p.Write(out, p.NSLCD_RESULT_END))
+ return nil
EOT
done < "$requests"
)
default:
- close(ch)
- panic(p.NslcdError(fmt.Sprintf("Unknown request action: %#08x", action)))
- }
- maybePanic(p.Write(out, p.NSLCD_VERSION))
- maybePanic(p.Write(out, action))
-
- for result := range ch {
- maybePanic(p.Write(out, p.NSLCD_RESULT_BEGIN))
- maybePanic(p.Write(out, result))
+ return p.NslcdError(fmt.Sprintf("Unknown request action: %#08x", action))
}
- maybePanic(p.Write(out, p.NSLCD_RESULT_END))
}
EOF