nacho       2002/10/02 18:33:15

  Modified:    jk/native2/common jk_channel_apr_socket.c jk_uriEnv.c
                        jk_uriMap.c jk_worker_jni.c jk_worker_lb.c
  Log:
  Problems with EOL
  
  I was  unable to catch any of the multiple times this issue was discussed on the 
list, but again..
  
  Committing files with diferent EOL than the plataform we are working on,
  damages them in CVS.. there are many ways to do this, but one of the
  most commons is to have the sources in a linux i.e., edit them in win32
  with an editor the completes the lf with a cr and commit then form linux..
  I suppouse that are many combinations for that circunstance, take care..
  
  Maybe old cygwin versions are problematic too , i dont know..
  
  Revision  Changes    Path
  1.27      +32 -32    
jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c
  
  Index: jk_channel_apr_socket.c
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- jk_channel_apr_socket.c   2 Oct 2002 12:50:05 -0000       1.26
  +++ jk_channel_apr_socket.c   3 Oct 2002 01:33:14 -0000       1.27
  @@ -219,20 +219,20 @@
       apr_socket_t *sock=endpoint->channelData;
       apr_status_t ret;
       apr_int32_t timeout = (apr_int32_t)(socketInfo->timeout * APR_USEC_PER_SEC);
  -    char msg[128];
  +    char msg[128];
       int connected = 0;
  -
  +
       while (remote_sa && !connected) {
           if ((ret = apr_socket_create(&sock, remote_sa->family, SOCK_STREAM,
                                        (apr_pool_t *)env->globalPool->_private))
                                       != APR_SUCCESS) {
               env->l->jkLog(env, env->l, remote_sa->next ? JK_LOG_DEBUG : 
JK_LOG_ERROR,
                            "channelApr.open(): error %d creating socket %d %s\n",
  -                          ret, socketInfo->host);
  -            remote_sa = remote_sa->next;
  -            continue;
  -        }
  -
  +                          ret, socketInfo->host);
  +            remote_sa = remote_sa->next;
  +            continue;
  +        }
  +
   
           env->l->jkLog(env, env->l, JK_LOG_INFO,
               "channelApr.open(): create tcp socket %d\n", sock );
  @@ -240,33 +240,33 @@
           /* the default timeout (0) will set the socket to blocking with
              infinite timeouts.
           */
  -        if (timeout <= 0)
  -            apr_socket_timeout_set(sock, 0);
  -        else
  +        if (timeout <= 0)
  +            apr_socket_timeout_set(sock, 0);
  +        else
               apr_socket_timeout_set(sock, timeout);
  -
  -        /* make the connection out of the socket */
  -        do { 
  -            ret = apr_connect(sock, remote_sa);
  -        } while (APR_STATUS_IS_EINTR(ret));
  -        
  -        /* if an error occurred, loop round and try again */
  -        if (ret != APR_SUCCESS) {
  -            apr_socket_close(sock);
  -            env->l->jkLog(env, env->l, remote_sa->next ? JK_LOG_DEBUG : 
JK_LOG_ERROR,
  -                         "channelApr.open() attempt to connect to %pI (%s) failed 
%d\n",
  -                         remote_sa,
  -                         socketInfo->host,
  -                         ret);
  -            remote_sa = remote_sa->next;
  -            continue;
  -        }
  -        connected = 1;
  -    }
   
  -    if (!connected) {
  -        apr_socket_close(sock);   
  -        return JK_ERR;
  +        /* make the connection out of the socket */
  +        do { 
  +            ret = apr_connect(sock, remote_sa);
  +        } while (APR_STATUS_IS_EINTR(ret));
  +        
  +        /* if an error occurred, loop round and try again */
  +        if (ret != APR_SUCCESS) {
  +            apr_socket_close(sock);
  +            env->l->jkLog(env, env->l, remote_sa->next ? JK_LOG_DEBUG : 
JK_LOG_ERROR,
  +                         "channelApr.open() attempt to connect to %pI (%s) failed 
%d\n",
  +                         remote_sa,
  +                         socketInfo->host,
  +                         ret);
  +            remote_sa = remote_sa->next;
  +            continue;
  +        }
  +        connected = 1;
  +    }
  +
  +    if (!connected) {
  +        apr_socket_close(sock);   
  +        return JK_ERR;
       }
       /* enable the use of keep-alive packets on TCP connection */
       if(keepalive) {
  
  
  
  1.36      +11 -11    jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c
  
  Index: jk_uriEnv.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jk_uriEnv.c       2 Oct 2002 10:27:17 -0000       1.35
  +++ jk_uriEnv.c       3 Oct 2002 01:33:14 -0000       1.36
  @@ -104,7 +104,7 @@
           uriEnv->virtual = uriEnv->pool->pstrdup(env, uriEnv->pool, host);
           return JK_OK;
       }
  -    *uri = '\0';
  +    *uri = '\0';
       if (colon)
           uriEnv->port = atoi(colon);
      
  @@ -133,9 +133,9 @@
           return uriEnv->uri;
       } else if( strcmp( name, "group" )==0 ) {
           return uriEnv->workerName;
  -    } else if( strcmp( name, "context" )==0 ) {
  -        return uriEnv->contextPath;
  -    }
  +    } else if( strcmp( name, "context" )==0 ) {
  +        return uriEnv->contextPath;
  +    }
       return NULL;
   }
   
  @@ -356,16 +356,16 @@
           } else {
               /* context based /context/prefix/ASTERISK  */
               asterisk[1]      = '\0';
  -
  +
               uriEnv->suffix      = NULL;
               uriEnv->prefix      = uri;
               uriEnv->prefix_len  =strlen( uriEnv->prefix );
  -            uriEnv->match_type  = MATCH_TYPE_PREFIX;
  -            if( uriEnv->mbean->debug > 0 ) {
  -                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                              "uriEnv.init() prefix mapping %s=%s\n",
  -                              uriEnv->prefix, uriEnv->workerName);
  -            }
  +            uriEnv->match_type  = MATCH_TYPE_PREFIX;
  +            if( uriEnv->mbean->debug > 0 ) {
  +                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                              "uriEnv.init() prefix mapping %s=%s\n",
  +                              uriEnv->prefix, uriEnv->workerName);
  +            }
           }
       } else {
           /* Something like : JkMount /servlets/exampl* ajp13 */
  
  
  
  1.49      +206 -206  jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c
  
  Index: jk_uriMap.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriMap.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- jk_uriMap.c       2 Oct 2002 10:58:06 -0000       1.48
  +++ jk_uriMap.c       3 Oct 2002 01:33:14 -0000       1.49
  @@ -171,32 +171,32 @@
           if (uriLen < uwr->prefix_len)
               continue;
           if (strncmp(uri, uwr->prefix, uwr->prefix_len) == 0) {
  -            if (uwr->prefix_len > best_match) {
  +            if (uwr->prefix_len > best_match) {
                   best_match=uwr->prefix_len;
  -                match=uwr;
  +                match=uwr;
               }
           }
       }
       return match;
   }
  -
  -static jk_uriEnv_t *jk2_uriMap_contextMap(jk_env_t *env, jk_uriMap_t *uriMap,
  -                                          jk_map_t *mapTable, const char *uri, 
  -                                          int uriLen)
  -{
  -    int i;    
  -    int sz = mapTable->size(env, mapTable);
  -
  -    for (i = 0; i < sz; i++) {
  -        jk_uriEnv_t *uwr = mapTable->valueAt(env, mapTable, i);
  -        if (uriLen != uwr->prefix_len - 1)
  -            continue;
  -        if (strncmp(uri, uwr->prefix, uriLen) == 0) {
  -            return uwr;
  -        }
  -    }
  -    return NULL;
  -}
  +
  +static jk_uriEnv_t *jk2_uriMap_contextMap(jk_env_t *env, jk_uriMap_t *uriMap,
  +                                          jk_map_t *mapTable, const char *uri, 
  +                                          int uriLen)
  +{
  +    int i;    
  +    int sz = mapTable->size(env, mapTable);
  +
  +    for (i = 0; i < sz; i++) {
  +        jk_uriEnv_t *uwr = mapTable->valueAt(env, mapTable, i);
  +        if (uriLen != uwr->prefix_len - 1)
  +            continue;
  +        if (strncmp(uri, uwr->prefix, uriLen) == 0) {
  +            return uwr;
  +        }
  +    }
  +    return NULL;
  +}
   
   static jk_uriEnv_t *jk2_uriMap_exactMap(jk_env_t *env, jk_uriMap_t *uriMap,
                                           jk_map_t *mapTable, const char *uri, 
  @@ -294,158 +294,158 @@
       }
       return uriMap->vhosts->get(env, uriMap->vhosts, "*");
   }
  -
  -static void jk2_uriMap_createHosts(jk_env_t *env, jk_uriMap_t *uriMap)
  -{
  -    int i;
  -
  -    for (i = 0; i < uriMap->maps->size(env, uriMap->maps); i++) {
  -        jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);
  -        if (uriEnv == NULL) 
  -            continue;
  -        if (uriEnv->virtual != NULL && strlen(uriEnv->virtual)) {
  -            if (uriEnv->match_type == MATCH_TYPE_HOST) {
  -                jk2_map_default_create(env, &uriEnv->webapps, uriMap->pool);
  -                uriMap->vhosts->put(env, uriMap->vhosts,
  -                                    uriEnv->virtual, uriEnv, NULL);
  -            } 
  -            else { /* Create the missing vhosts */
  -                if (!uriMap->vhosts->get(env, uriMap->vhosts,
  -                                         uriEnv->virtual)) {
  -                    jk2_map_default_create(env, &uriEnv->webapps, uriMap->pool);
  -                    uriMap->vhosts->put(env, uriMap->vhosts,
  -                                        uriEnv->virtual, uriEnv, NULL);
  -
  -                    env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                                  "uriMap.init() Fixing Host %s\n", 
  -                                  uriEnv->virtual);
  -                }
  -            }
  -        }
  -    }
  -
  -    /** Make sure each vhost has a default context
  -     */
  -    for(i = 0; i < uriMap->vhosts->size(env, uriMap->vhosts); i++) {
  -        jk_uriEnv_t *hostEnv = uriMap->vhosts->valueAt(env, uriMap->vhosts, i);
  -        jk_uriEnv_t *rootCtx;
  -        char *uriPath;
  -        
  -        if (hostEnv->virtual != NULL) {
  -            uriPath=env->tmpPool->calloc(env, env->tmpPool,
  -                                         strlen(hostEnv->virtual) + 3);
  -            strcpy(uriPath, hostEnv->virtual);
  -            strcat(uriPath, "/");
  -        } else {
  -            uriPath = "/";
  -        }
  -        
  -        rootCtx = env->getByName2(env, "uri", uriPath);
  -        if (rootCtx == NULL) {
  -            env->createBean2(env, uriMap->mbean->pool, "uri", uriPath);
  -            rootCtx = env->getByName2(env, "uri", uriPath);
  -            if (uriMap->mbean->debug > 0) 
  -                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                              "uriMap.init() Create default context %s\n", 
uriPath);
  -            rootCtx->mbean->setAttribute(env, rootCtx->mbean, "context", "/");
  -        }
  -    }
  -}
  -
  -static void jk2_uriMap_createWebapps(jk_env_t *env, jk_uriMap_t *uriMap)
  -{
  -    int i;
  -
  -    /* Init all contexts */
  -    /* For each context, init the local uri maps */
  -    for (i = 0; i < uriMap->maps->size(env, uriMap->maps); i++) {
  -        jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);
  -        char *uri;
  -        char *context;
  -        if (uriEnv == NULL) {
  -            env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                          "uriMap.init() NPE\n");
  -        }
  -        uri = uriEnv->uri;
  -        context = uriEnv->contextPath;
  -
  -        if (uri != NULL && context != NULL && strcmp(uri, context) == 0) {
  -            char *vhost = uriEnv->virtual;
  -            int  port = uriEnv->port;
  -            jk_uriEnv_t *hostEnv = jk2_uriMap_hostMap(env, uriMap, vhost, port);
  -            if (!hostEnv)
  -                continue;
  -            if (  uriMap->mbean->debug > 5) 
  -                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                              "uriMap.init() loaded context %s %s %#lx %#lx 
%#lx\n",
  -                              uriEnv->virtual, context, hostEnv, hostEnv->webapps,
  -                              uriMap->pool); 
  -            uriEnv->match_type = MATCH_TYPE_CONTEXT;
  -
  -            uriEnv->prefix = context;
  -            uriEnv->prefix_len = strlen(context);
  -            hostEnv->webapps->put(env, hostEnv->webapps, context, uriEnv, NULL);
  -            jk2_map_default_create(env, &uriEnv->exactMatch, uriMap->pool);
  -            jk2_map_default_create(env, &uriEnv->prefixMatch, uriMap->pool);
  -            jk2_map_default_create(env, &uriEnv->suffixMatch, uriMap->pool);
  -        }
  -    }
  -    
  -    /* Now, fix the webapps finding context from each uri 
  -     * and create one if not found.
  -     */
  -    for (i = 0; i < uriMap->maps->size(env, uriMap->maps ); i++) {
  -        jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);        
  -        char *vhost= uriEnv->virtual;
  -        int  port = uriEnv->port;
  -        char *context= uriEnv->contextPath;
  -        jk_uriEnv_t *hostEnv = jk2_uriMap_hostMap(env, uriMap, vhost, port);
  -        jk_uriEnv_t *ctxEnv;
  -        
  -        env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                              "uriMap: fix uri %s context %s\n", uriEnv->uri, 
uriEnv->contextPath );
  -        if (context == NULL) {
  -            if (  uriMap->mbean->debug > 5) 
  -                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                              "uriMap: no context %s\n", uriEnv->uri );
  -            continue;
  -        }
  -        
  -        ctxEnv = jk2_uriMap_exactMap(env, uriMap, hostEnv->webapps, context,
  -                                      strlen(context));
  -        /* if not alredy created, create it */
  -        if (ctxEnv == NULL) {
  -            jk_bean_t *mbean;
  -            char *ctxname;
  -
  -            ctxname = uriEnv->pool->calloc(env, uriEnv->pool, strlen(vhost) + 
  -                                           strlen(context) + 1 );
  -
  -            strcpy(ctxname, vhost);
  -            strcat(ctxname, context);
  -
  -            env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                          "uriMap: creating context %s\n", ctxname);
  -            mbean = env->getBean2(env, "uri", context);
  -            if (mbean == NULL)
  -                mbean = env->createBean2(env, uriMap->pool,"uri", ctxname);
  -            if (mbean == NULL || mbean->object == NULL) {
  -                env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                              "uriMap: can't create context object %s\n",ctxname);
  -                continue;
  -            }
  -            ctxEnv = mbean->object;
  -            ctxEnv->match_type = MATCH_TYPE_CONTEXT;
  -            ctxEnv->prefix = context;
  -            ctxEnv->prefix_len = strlen(context);
  -            hostEnv->webapps->put(env, hostEnv->webapps, context, ctxEnv, NULL);
  -            jk2_map_default_create(env, &ctxEnv->exactMatch, uriMap->pool);
  -            jk2_map_default_create(env, &ctxEnv->prefixMatch, uriMap->pool);
  -            jk2_map_default_create(env, &ctxEnv->suffixMatch, uriMap->pool);
  -        }
  -    } 
  -
  -}
  +
  +static void jk2_uriMap_createHosts(jk_env_t *env, jk_uriMap_t *uriMap)
  +{
  +    int i;
  +
  +    for (i = 0; i < uriMap->maps->size(env, uriMap->maps); i++) {
  +        jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);
  +        if (uriEnv == NULL) 
  +            continue;
  +        if (uriEnv->virtual != NULL && strlen(uriEnv->virtual)) {
  +            if (uriEnv->match_type == MATCH_TYPE_HOST) {
  +                jk2_map_default_create(env, &uriEnv->webapps, uriMap->pool);
  +                uriMap->vhosts->put(env, uriMap->vhosts,
  +                                    uriEnv->virtual, uriEnv, NULL);
  +            } 
  +            else { /* Create the missing vhosts */
  +                if (!uriMap->vhosts->get(env, uriMap->vhosts,
  +                                         uriEnv->virtual)) {
  +                    jk2_map_default_create(env, &uriEnv->webapps, uriMap->pool);
  +                    uriMap->vhosts->put(env, uriMap->vhosts,
  +                                        uriEnv->virtual, uriEnv, NULL);
  +
  +                    env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                                  "uriMap.init() Fixing Host %s\n", 
  +                                  uriEnv->virtual);
  +                }
  +            }
  +        }
  +    }
  +
  +    /** Make sure each vhost has a default context
  +     */
  +    for(i = 0; i < uriMap->vhosts->size(env, uriMap->vhosts); i++) {
  +        jk_uriEnv_t *hostEnv = uriMap->vhosts->valueAt(env, uriMap->vhosts, i);
  +        jk_uriEnv_t *rootCtx;
  +        char *uriPath;
  +        
  +        if (hostEnv->virtual != NULL) {
  +            uriPath=env->tmpPool->calloc(env, env->tmpPool,
  +                                         strlen(hostEnv->virtual) + 3);
  +            strcpy(uriPath, hostEnv->virtual);
  +            strcat(uriPath, "/");
  +        } else {
  +            uriPath = "/";
  +        }
  +        
  +        rootCtx = env->getByName2(env, "uri", uriPath);
  +        if (rootCtx == NULL) {
  +            env->createBean2(env, uriMap->mbean->pool, "uri", uriPath);
  +            rootCtx = env->getByName2(env, "uri", uriPath);
  +            if (uriMap->mbean->debug > 0) 
  +                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                              "uriMap.init() Create default context %s\n", uriPath);
  +            rootCtx->mbean->setAttribute(env, rootCtx->mbean, "context", "/");
  +        }
  +    }
  +}
  +
  +static void jk2_uriMap_createWebapps(jk_env_t *env, jk_uriMap_t *uriMap)
  +{
  +    int i;
  +
  +    /* Init all contexts */
  +    /* For each context, init the local uri maps */
  +    for (i = 0; i < uriMap->maps->size(env, uriMap->maps); i++) {
  +        jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);
  +        char *uri;
  +        char *context;
  +        if (uriEnv == NULL) {
  +            env->l->jkLog(env, env->l, JK_LOG_INFO,
  +                          "uriMap.init() NPE\n");
  +        }
  +        uri = uriEnv->uri;
  +        context = uriEnv->contextPath;
  +
  +        if (uri != NULL && context != NULL && strcmp(uri, context) == 0) {
  +            char *vhost = uriEnv->virtual;
  +            int  port = uriEnv->port;
  +            jk_uriEnv_t *hostEnv = jk2_uriMap_hostMap(env, uriMap, vhost, port);
  +            if (!hostEnv)
  +                continue;
  +            if (  uriMap->mbean->debug > 5) 
  +                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                              "uriMap.init() loaded context %s %s %#lx %#lx %#lx\n",
  +                              uriEnv->virtual, context, hostEnv, hostEnv->webapps,
  +                              uriMap->pool); 
  +            uriEnv->match_type = MATCH_TYPE_CONTEXT;
  +
  +            uriEnv->prefix = context;
  +            uriEnv->prefix_len = strlen(context);
  +            hostEnv->webapps->put(env, hostEnv->webapps, context, uriEnv, NULL);
  +            jk2_map_default_create(env, &uriEnv->exactMatch, uriMap->pool);
  +            jk2_map_default_create(env, &uriEnv->prefixMatch, uriMap->pool);
  +            jk2_map_default_create(env, &uriEnv->suffixMatch, uriMap->pool);
  +        }
  +    }
  +    
  +    /* Now, fix the webapps finding context from each uri 
  +     * and create one if not found.
  +     */
  +    for (i = 0; i < uriMap->maps->size(env, uriMap->maps ); i++) {
  +        jk_uriEnv_t *uriEnv = uriMap->maps->valueAt(env, uriMap->maps, i);        
  +        char *vhost= uriEnv->virtual;
  +        int  port = uriEnv->port;
  +        char *context= uriEnv->contextPath;
  +        jk_uriEnv_t *hostEnv = jk2_uriMap_hostMap(env, uriMap, vhost, port);
  +        jk_uriEnv_t *ctxEnv;
  +        
  +        env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                              "uriMap: fix uri %s context %s\n", uriEnv->uri, 
uriEnv->contextPath );
  +        if (context == NULL) {
  +            if (  uriMap->mbean->debug > 5) 
  +                env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                              "uriMap: no context %s\n", uriEnv->uri );
  +            continue;
  +        }
  +        
  +        ctxEnv = jk2_uriMap_exactMap(env, uriMap, hostEnv->webapps, context,
  +                                      strlen(context));
  +        /* if not alredy created, create it */
  +        if (ctxEnv == NULL) {
  +            jk_bean_t *mbean;
  +            char *ctxname;
  +
  +            ctxname = uriEnv->pool->calloc(env, uriEnv->pool, strlen(vhost) + 
  +                                           strlen(context) + 1 );
  +
  +            strcpy(ctxname, vhost);
  +            strcat(ctxname, context);
  +
  +            env->l->jkLog(env, env->l, JK_LOG_INFO,
  +                          "uriMap: creating context %s\n", ctxname);
  +            mbean = env->getBean2(env, "uri", context);
  +            if (mbean == NULL)
  +                mbean = env->createBean2(env, uriMap->pool,"uri", ctxname);
  +            if (mbean == NULL || mbean->object == NULL) {
  +                env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                              "uriMap: can't create context object %s\n",ctxname);
  +                continue;
  +            }
  +            ctxEnv = mbean->object;
  +            ctxEnv->match_type = MATCH_TYPE_CONTEXT;
  +            ctxEnv->prefix = context;
  +            ctxEnv->prefix_len = strlen(context);
  +            hostEnv->webapps->put(env, hostEnv->webapps, context, ctxEnv, NULL);
  +            jk2_map_default_create(env, &ctxEnv->exactMatch, uriMap->pool);
  +            jk2_map_default_create(env, &ctxEnv->prefixMatch, uriMap->pool);
  +            jk2_map_default_create(env, &ctxEnv->suffixMatch, uriMap->pool);
  +        }
  +    } 
  +
  +}
   
   static int jk2_uriMap_init(jk_env_t *env, jk_uriMap_t *uriMap)
   {
  @@ -465,10 +465,10 @@
       }
   
       /* Create virtual hosts and initialize them */
  -    jk2_uriMap_createHosts(env, uriMap);
  -
  -    /* Create webapps and initialize them */
  -    jk2_uriMap_createWebapps(env, uriMap);
  +    jk2_uriMap_createHosts(env, uriMap);
  +
  +    /* Create webapps and initialize them */
  +    jk2_uriMap_createWebapps(env, uriMap);
   
       if (uriMap->mbean->debug > 5) 
           env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  @@ -498,13 +498,13 @@
   
           if (uri == NULL)
               continue;
  -        
  -        /* If the context was specified try to find the exact one */
  -        if (uriEnv->contextPath != NULL)
  -            ctxEnv = jk2_uriMap_exactMap(env, uriMap, hostEnv->webapps,
  -                                         uriEnv->contextPath,
  -                                         uriEnv->ctxt_len);
  -        /* Next find by uri prefix */
  +        
  +        /* If the context was specified try to find the exact one */
  +        if (uriEnv->contextPath != NULL)
  +            ctxEnv = jk2_uriMap_exactMap(env, uriMap, hostEnv->webapps,
  +                                         uriEnv->contextPath,
  +                                         uriEnv->ctxt_len);
  +        /* Next find by uri prefix */
           if (ctxEnv == NULL)
               ctxEnv = jk2_uriMap_prefixMap(env, uriMap, hostEnv->webapps, uri,
                                             strlen(uri));
  @@ -513,15 +513,15 @@
               env->l->jkLog(env, env->l, JK_LOG_INFO, 
                              "uriMap.init() no context for %s\n", uri); 
               return JK_ERR;
  -        }
  -
  -        /* Correct the context path if needed */
  -        uriEnv->contextPath = ctxEnv->prefix;
  -        uriEnv->ctxt_len = ctxEnv->prefix_len;
  -
  -        if (uriMap->mbean->debug > 5) 
  -            env->l->jkLog(env, env->l, JK_LOG_INFO, 
  -                          "uriMap.init() adding context %s for %s\n", 
ctxEnv->prefix, uri); 
  +        }
  +
  +        /* Correct the context path if needed */
  +        uriEnv->contextPath = ctxEnv->prefix;
  +        uriEnv->ctxt_len = ctxEnv->prefix_len;
  +
  +        if (uriMap->mbean->debug > 5) 
  +            env->l->jkLog(env, env->l, JK_LOG_INFO, 
  +                          "uriMap.init() adding context %s for %s\n", 
ctxEnv->prefix, uri); 
   
           switch (uriEnv->match_type) {
               case MATCH_TYPE_EXACT:
  @@ -693,19 +693,19 @@
           }
       }
       
  -    /* Try to find exact match of /uri and prefix /uri/* */
  -    match = jk2_uriMap_contextMap(env, uriMap, ctxEnv->prefixMatch, uri, uriLen);
  -    if (match != NULL) {
  -        /* restore */
  -        if (url_rewrite)
  -            *url_rewrite = origChar;
  -        if (uriMap->mbean->debug > 0)
  -            env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  -                          "uriMap.mapUri() context match %s %s\n",
  -                          uri, match->workerName); 
  -        return match;
  -    }
  -
  +    /* Try to find exact match of /uri and prefix /uri/* */
  +    match = jk2_uriMap_contextMap(env, uriMap, ctxEnv->prefixMatch, uri, uriLen);
  +    if (match != NULL) {
  +        /* restore */
  +        if (url_rewrite)
  +            *url_rewrite = origChar;
  +        if (uriMap->mbean->debug > 0)
  +            env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                          "uriMap.mapUri() context match %s %s\n",
  +                          uri, match->workerName); 
  +        return match;
  +    }
  +
       /* And extension match at the end */
       /* Only once, no need to compute it for each extension match */
       suffix = jk2_findExtension(env, uri);
  @@ -723,7 +723,7 @@
               return match;
           }
       }
  -
  +
       /* restore */
       if (url_rewrite)
           *url_rewrite = origChar;
  
  
  
  1.29      +4 -4      jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c
  
  Index: jk_worker_jni.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- jk_worker_jni.c   2 Oct 2002 12:48:26 -0000       1.28
  +++ jk_worker_jni.c   3 Oct 2002 01:33:15 -0000       1.29
  @@ -66,10 +66,10 @@
   #include "jk_workerEnv.h"
   #include "jk_env.h"
   #include "jk_bean.h"
  -
  -#ifdef HAVE_JNI
   
  -#include "apr_thread_proc.h"
  +#ifdef HAVE_JNI
  +
  +#include "apr_thread_proc.h"
   
   #include "jk_vm.h"
   #include "jk_registry.h"
  @@ -498,4 +498,4 @@
       return JK_OK;
   }
        
  -#endif
  +#endif
  
  
  
  1.25      +30 -30    jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c
  
  Index: jk_worker_lb.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_worker_lb.c    2 Oct 2002 15:36:22 -0000       1.24
  +++ jk_worker_lb.c    3 Oct 2002 01:33:15 -0000       1.25
  @@ -85,11 +85,11 @@
   
   typedef struct {
       struct  jk_mutex *cs;
  -    int     initializing;
  -    int     attempts;
  -    int     recovery;
  -    int     timeout;
  -    time_t  error_time;
  +    int     initializing;
  +    int     attempts;
  +    int     recovery;
  +    int     timeout;
  +    time_t  error_time;
   
   } jk_worker_lb_private_t;
   
  @@ -113,7 +113,7 @@
       int currentLevel=JK_LB_LEVELS - 1;
       char *session_route;
       time_t now = 0;
  -    jk_worker_lb_private_t *lb_priv = lb->worker_private;
  +    jk_worker_lb_private_t *lb_priv = lb->worker_private;
   
       session_route = jk2_requtil_getSessionRoute(env, s);
          
  @@ -125,7 +125,7 @@
                   if(w->route != NULL &&
                      0 == strcmp(session_route, w->route)) {
                       if(attempt > 0 && w->in_error_state) {
  -                        /* We already tried to revive this worker. */
  +                        /* We already tried to revive this worker. */
                           break;
                       } else {
                           return w;
  @@ -337,17 +337,17 @@
               rec=jk2_get_most_suitable_worker(env, lb, s, attempt);
   
               if (lb_priv->cs != NULL)
  -                lb_priv->cs->unLock(env, lb_priv->cs);
  -            if (!rec && lb_priv->timeout) {
  -                time_t now = time(NULL);
  -                if ((int)(now - lb_priv->error_time) < lb_priv->timeout) {
  -#ifdef HAS_APR
  -                    apr_thread_yield();
  -#endif
  -                    continue;
  -                }
  -            }
  -            else
  +                lb_priv->cs->unLock(env, lb_priv->cs);
  +            if (!rec && lb_priv->timeout) {
  +                time_t now = time(NULL);
  +                if ((int)(now - lb_priv->error_time) < lb_priv->timeout) {
  +#ifdef HAS_APR
  +                    apr_thread_yield();
  +#endif
  +                    continue;
  +                }
  +            }
  +            else
                   lb_priv->error_time = time(NULL);
           }
           else if (!rec){
  @@ -357,7 +357,7 @@
               if (lb->cs != NULL) {
                   lb->cs->lock(env, lb->cs);
                   lb->cs->unLock(env, lb->cs);
  -            }
  +            }
               continue;
           }
           attempt++;
  @@ -387,7 +387,7 @@
               }
               
               s->afterRequest( env, s);
  -            lb_priv->error_time = time(NULL);
  +            lb_priv->error_time = time(NULL);
               return JK_ERR;
           }
   
  @@ -520,7 +520,7 @@
       jk_worker_t *lb=mbean->object;
       char *value=valueP;
       unsigned i = 0;
  -    jk_worker_lb_private_t *lb_priv = lb->worker_private;
  +    jk_worker_lb_private_t *lb_priv = lb->worker_private;
       
       if( strcmp( name, "worker") == 0 ) {
           if( lb->lbWorkerMap->get( env, lb->lbWorkerMap, name) != NULL ) {
  @@ -542,13 +542,13 @@
           lb->noWorkerCode=atoi( value );
       } else if( strcmp( name, "hwBalanceErr") == 0 ) {
           lb->hwBalanceErr=atoi( value );
  -    } else if( strcmp( name, "timeout") == 0 ) {
  -        lb_priv->timeout=atoi( value );
  -    } else if( strcmp( name, "recovery") == 0 ) {
  -        lb_priv->recovery=atoi( value );
  -    } else if( strcmp( name, "attempts") == 0 ) {
  -        lb_priv->attempts=atoi( value );
  -    }
  +    } else if( strcmp( name, "timeout") == 0 ) {
  +        lb_priv->timeout=atoi( value );
  +    } else if( strcmp( name, "recovery") == 0 ) {
  +        lb_priv->recovery=atoi( value );
  +    } else if( strcmp( name, "attempts") == 0 ) {
  +        lb_priv->attempts=atoi( value );
  +    }
       return JK_ERR;
   }
   
  @@ -619,8 +619,8 @@
       if( jkb != NULL ) {
           worker_private->cs=jkb->object;
           jkb->init(env, jkb );
  -    }
  -    worker_private->attempts = MAX_ATTEMPTS;
  +    }
  +    worker_private->attempts = MAX_ATTEMPTS;
       worker_private->recovery = WAIT_BEFORE_RECOVER;
       w->worker_private = worker_private;
       w->service        = jk2_lb_service;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to