]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] apply the contimeout to the queue by default.
authorwilly tarreau <willy@wtap.(none)>
Wed, 3 May 2006 18:11:50 +0000 (20:11 +0200)
committerwilly tarreau <willy@wtap.(none)>
Wed, 3 May 2006 18:11:50 +0000 (20:11 +0200)
An improvement will be to have a separate timeout for the queue.

haproxy.c

index 948fa8d7ac12b1c962d20855362e177ab9627351..a5c0035b431e0621b28697257ba25129ec4b5281 100644 (file)
--- a/haproxy.c
+++ b/haproxy.c
@@ -4642,6 +4642,11 @@ int srv_redispatch_connect(struct session *t) {
        return 1;
 
     case SRV_STATUS_QUEUED:
+       /* FIXME-20060503 : we should use the queue timeout instead */
+       if (t->proxy->contimeout)
+           tv_delayfrom(&t->cnexpire, &now, t->proxy->contimeout);
+       else
+           tv_eternity(&t->cnexpire);
        t->srv_state = SV_STIDLE;
        /* do nothing else and do not wake any other session up */
        return 1;
@@ -4707,8 +4712,17 @@ int process_srv(struct session *t) {
             * which case we will not do anything till it's pending. It's up
             * to any other session to release it and wake us up again.
             */
-           if (t->pend_pos)
-               return 0;
+           if (t->pend_pos) {
+               if (tv_cmp2_ms(&t->cnexpire, &now) > 0)
+                   return 0;
+               else {
+                   /* we've been waiting too long here */
+                   tv_eternity(&t->cnexpire);
+                   srv_close_with_err(t, SN_ERR_SRVTO, SN_FINST_C,
+                                      503, t->proxy->errmsg.len503, t->proxy->errmsg.msg503);
+                   return 1;
+               }
+           }
 
            do {
                /* first, get a connection */