summaryrefslogtreecommitdiff
path: root/nslcd_server
diff options
context:
space:
mode:
Diffstat (limited to 'nslcd_server')
-rwxr-xr-xnslcd_server/func_handlerequest.go.gen24
1 files changed, 18 insertions, 6 deletions
diff --git a/nslcd_server/func_handlerequest.go.gen b/nslcd_server/func_handlerequest.go.gen
index 7c28e7c..00e9663 100755
--- a/nslcd_server/func_handlerequest.go.gen
+++ b/nslcd_server/func_handlerequest.go.gen
@@ -84,14 +84,20 @@ func HandleRequest(backend Backend, limits Limits, conn Conn, cred unix.Ucred) (
}()
now := time.Now()
+ deadlineAll := time.Time{}
+ deadlineRead := time.Time{}
if limits.Timeout != 0 {
- err = conn.SetDeadline(now.Add(limits.Timeout))
- if err != nil {
- return err
- }
+ deadlineAll = now.Add(limits.Timeout)
}
if limits.ReadTimeout != 0 {
- err = conn.SetReadDeadline(now.Add(limits.ReadTimeout))
+ deadlineRead = now.Add(limits.ReadTimeout)
+ if !deadlineAll.IsZero() && deadlineAll.Before(deadlineRead) {
+ deadlineRead = deadlineAll
+ }
+ }
+ deadlineWrite := deadlineAll
+ if !deadlineRead.IsZero() {
+ err = conn.SetReadDeadline(deadlineRead)
if err != nil {
return err
}
@@ -144,7 +150,13 @@ while read -r request; do
esac
)
if limits.WriteTimeout != 0 {
- err = out.SetWriteDeadline(time.Now().Add(limits.WriteTimeout))
+ deadlineWrite = time.Now().Add(limits.WriteTimeout)
+ if !deadlineAll.IsZero() && deadlineAll.Before(deadlineWrite) {
+ deadlineWrite = deadlineAll
+ }
+ }
+ if !deadlineWrite.IsZero() {
+ err = out.SetWriteDeadline(deadlineWrite)
if err != nil {
return err
}