tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r612564 - /tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
Date Wed, 16 Jan 2008 20:35:36 GMT
Author: rjung
Date: Wed Jan 16 12:35:33 2008
New Revision: 612564

URL: http://svn.apache.org/viewvc?rev=612564&view=rev
Log:
Now since we have the service struct in all find
methods, we don't need route_is_domain any more.
Let's set the service struct directly.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=612564&r1=612563&r2=612564&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Wed Jan 16 12:35:33 2008
@@ -743,7 +743,6 @@
 static int find_bysession_route(jk_ws_service_t *s,
                                 lb_worker_t *p,
                                 const char *name,
-                                int *route_is_domain,
                                 jk_logger_t *l)
 {
     int uses_domain  = 0;
@@ -753,10 +752,11 @@
     if (candidate < 0) {
         uses_domain = 1;
         candidate = find_best_bydomain(s, p, name, l);
-        *route_is_domain = JK_TRUE;
     }
     if (candidate >= 0) {
         lb_sub_worker_t wr = p->lb_workers[candidate];
+        if (uses_domain)
+            s->route = wr.domain;
         if (!JK_WORKER_USABLE_STICKY(&wr)) {
             /* We have a worker that is error state or stopped.
              * If it has a redirection set use that redirection worker.
@@ -768,11 +768,11 @@
                 candidate = -1;
             else if (*wr.redirect) {
                 candidate = find_by_session(s, p, wr.redirect, l);
-                *route_is_domain = JK_FALSE;
+                s->route = NULL;
             }
             else if (*wr.domain && !uses_domain) {
                 candidate = find_best_bydomain(s, p, wr.domain, l);
-                *route_is_domain = JK_TRUE;
+                s->route = wr.domain;
             }
             if (candidate >= 0) {
                 wr = p->lb_workers[candidate];
@@ -786,7 +786,6 @@
 
 static int find_failover_worker(jk_ws_service_t *s,
                                 lb_worker_t * p,
-                                int *route_is_domain,
                                 jk_logger_t *l)
 {
     int rc = -1;
@@ -800,13 +799,12 @@
         }
     }
     if (redirect)
-        rc = find_bysession_route(s, p, redirect, route_is_domain, l);
+        rc = find_bysession_route(s, p, redirect, l);
     return rc;
 }
 
 static int find_best_worker(jk_ws_service_t *s,
                             lb_worker_t * p,
-                            int *route_is_domain,
                             jk_logger_t *l)
 {
     int rc = -1;
@@ -814,14 +812,13 @@
     rc = find_best_byvalue(s, p, l);
     /* By default use worker route as session route */
     if (rc < 0)
-        rc = find_failover_worker(s, p, route_is_domain, l);
+        rc = find_failover_worker(s, p, l);
     return rc;
 }
 
 static lb_sub_worker_t *get_most_suitable_worker(jk_ws_service_t *s,
                                                  lb_worker_t * p,
                                                  char *sessionid,
-                                                 int *route_is_domain,
                                                  jk_logger_t *l)
 {
     int rc = -1;
@@ -874,7 +871,7 @@
                            session_route);
 
                 /* We have a session route. Whow! */
-                rc = find_bysession_route(s, p, session_route, route_is_domain, l);
+                rc = find_bysession_route(s, p, session_route, l);
                 if (rc >= 0) {
                     lb_sub_worker_t *wr = &(p->lb_workers[rc]);
                     if (p->lblock == JK_LB_LOCK_PESSIMISTIC)
@@ -907,7 +904,7 @@
             return NULL;
         }
     }
-    rc = find_best_worker(s, p, route_is_domain, l);
+    rc = find_best_worker(s, p, l);
     if (p->lblock == JK_LB_LOCK_PESSIMISTIC)
         jk_shm_unlock();
     else {
@@ -1034,9 +1031,8 @@
                p->worker->sticky_session, sessionid ? sessionid : "empty");
 
     while (attempt <= num_of_workers && recoverable == JK_TRUE) {
-        int route_is_domain = JK_FALSE;
         lb_sub_worker_t *rec =
-            get_most_suitable_worker(s, p->worker, sessionid, &route_is_domain, l);
+            get_most_suitable_worker(s, p->worker, sessionid, l);
         rc = JK_FALSE;
         *is_error = JK_HTTP_SERVER_BUSY;
         /* Do not reuse previous worker, because
@@ -1049,10 +1045,9 @@
             jk_endpoint_t *end = NULL;
             int retry = 0;
             int retry_wait = JK_LB_MIN_RETRY_WAIT;
-            if (route_is_domain == JK_FALSE)
+
+            if (!s->route)
                 s->route = rec->route;
-            else
-                s->route = rec->domain;
             prec = rec;
 
             if (JK_IS_DEBUG_LEVEL(l))



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message