tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_ajp14_worker.c jk_jni_worker.c jk_channel_socket.c jk_endpoint.c jk_env.c jk_handler_logon.c jk_handler_response.c jk_lb_worker.c
Date Thu, 06 Dec 2001 22:54:44 GMT
costin      01/12/06 14:54:44

  Modified:    jk/native2/common jk_ajp14_worker.c jk_jni_worker.c
                        jk_channel_socket.c jk_endpoint.c jk_env.c
                        jk_handler_logon.c jk_handler_response.c
                        jk_lb_worker.c
  Log:
  Updates for the interface changes.
  
  Use pools instead of malloc.
  
  Pools are now consistent ( i.e. jk_pool_t *pool ), no more on-stack pools.
  
  Revision  Changes    Path
  1.5       +25 -22    jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c
  
  Index: jk_ajp14_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_ajp14_worker.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_ajp14_worker.c	2001/12/05 20:48:20	1.4
  +++ jk_ajp14_worker.c	2001/12/06 22:54:44	1.5
  @@ -72,8 +72,8 @@
   #include "jk_service.h"
   #include "jk_env.h"
   
  -int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, void **result,
  -                                       char *type, char *name);
  +int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, jk_pool_t *pool, void **result,
  +                                       const char *type, const char *name);
   
   static int JK_METHOD
   jk_worker_ajp14_service(jk_endpoint_t   *e, jk_ws_service_t *s,
  @@ -102,19 +102,19 @@
   
   /* -------------------- Impl -------------------- */
   
  -int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, void **result,
  -                                       char *type, char *name)
  +int JK_METHOD jk_worker_ajp14_factory( jk_env_t *env, jk_pool_t *pool, void **result,
  +                                       const char *type, const char *name)
   {
       jk_logger_t *l=env->logger;
  -    jk_worker_t *w=(jk_worker_t *)malloc(sizeof(jk_worker_t));
  -   
  +    jk_worker_t *w=(jk_worker_t *)pool->calloc(pool, sizeof(jk_worker_t));
  +
       l->jkLog(l, JK_LOG_DEBUG, "Into ajp14_worker_factory\n");
   
       if (name == NULL || w == NULL) {
           l->jkLog(l, JK_LOG_ERROR, "In ajp14_worker_factory, NULL parameters\n");
           return JK_FALSE;
       }
  -
  +    w->pool = pool;
       w->name = strdup(name);
       
       w->proto= AJP14_PROTO;
  @@ -176,15 +176,15 @@
   	return JK_FALSE;
       }
   	
  -    e->request = jk_b_new(&(e->pool));
  +    e->request = jk_b_new(e->pool);
       jk_b_set_buffer_size(e->request, DEF_BUFFER_SZ); 
       jk_b_reset(e->request);
       
  -    e->reply = jk_b_new(&(e->pool));
  +    e->reply = jk_b_new(e->pool);
       jk_b_set_buffer_size(e->reply, DEF_BUFFER_SZ);
       jk_b_reset(e->reply); 
   	
  -    e->post = jk_b_new(&(e->pool));
  +    e->post = jk_b_new(e->pool);
       jk_b_set_buffer_size(e->post, DEF_BUFFER_SZ);
       jk_b_reset(e->post); 
       
  @@ -311,14 +311,11 @@
   	/* Create a default channel */
   	jk_env_t *env= we->env;
   
  -	jk_env_objectFactory_t fac = 
  -	    (jk_env_objectFactory_t)env->getFactory(env, "channel", "socket" );
  -	l->jkLog( l, JK_LOG_DEBUG, "Got socket channel factory \n");
  -
  -	err=fac( env, (void **)&pThis->channel, "channel", "socket" );
  -	if( err != JK_TRUE ) {
  -	    l->jkLog(l, JK_LOG_ERROR, "Error creating socket factory\n");
  -	    return err;
  +	pThis->channel=env->getInstance(env, pThis->pool,"channel", "socket" );
  +
  +	if( pThis->channel == NULL ) {
  +	    l->jkLog(l, JK_LOG_ERROR, "Error creating socket channel\n");
  +	    return JK_FALSE;
   	}
   	l->jkLog(l, JK_LOG_ERROR, "Got channel %lx %lx\n", pThis, pThis->channel);
       }
  @@ -385,7 +382,8 @@
                               jk_logger_t    *l)
   {
       jk_endpoint_t *ae = NULL;
  -
  +    jk_pool_t *endpointPool;
  +    
       if( _this->login->secret_key ==NULL ) {
       }
   
  @@ -413,14 +411,19 @@
           }
       }
   
  -    ae = (jk_endpoint_t *)malloc(sizeof(jk_endpoint_t));
  -    if (!ae) {
  +    endpointPool = _this->pool->create( _this->pool, HUGE_POOL_SIZE );
  +    
  +    ae = (jk_endpoint_t *)endpointPool->alloc(endpointPool,
  +                                              sizeof(jk_endpoint_t));
  +    if (ae==NULL) {
           l->jkLog(l, JK_LOG_ERROR, "ajp14.get_endpoint OutOfMemoryException\n");
           return JK_FALSE;
       }
       
       ae->reuse = JK_FALSE;
  -    jk_open_pool(&ae->pool, ae->buf, sizeof(ae->buf));
  +
  +    ae->pool = endpointPool;
  +
       ae->worker = _this;
       ae->proto = _this->proto;
       ae->channelData = NULL;
  
  
  
  1.7       +24 -26    jakarta-tomcat-connectors/jk/native2/common/jk_jni_worker.c
  
  Index: jk_jni_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_jni_worker.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- jk_jni_worker.c	2001/12/05 20:48:20	1.6
  +++ jk_jni_worker.c	2001/12/06 22:54:44	1.7
  @@ -59,7 +59,7 @@
    * Description: In process JNI worker                                      *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Based on:                                                               *
  - * Version:     $Revision: 1.6 $                                           *
  + * Version:     $Revision: 1.7 $                                           *
    ***************************************************************************/
   
   #if !defined(WIN32) && !defined(NETWARE)
  @@ -105,8 +105,7 @@
       int was_verified;
       int was_initialized;
   
  -    jk_pool_t p;
  -    jk_pool_atom_t buf[TINY_POOL_SIZE];
  +    jk_pool_t *pool;
   
       /*
        * JVM Object pointer.
  @@ -193,7 +192,7 @@
   };
   typedef struct jni_endpoint jni_endpoint_t;
   
  -int JK_METHOD jk_worker_jni_factory(jk_env_t *env, void **result,
  +int JK_METHOD jk_worker_jni_factory(jk_env_t *env, jk_pool_t *pool, void **result,
                                       char *type, char *name);
   
   static int load_jvm_dll(jni_worker_t *p,
  @@ -463,7 +462,7 @@
   
       str_config= map_getStrProp( props, "worker", p->name, "class_path", NULL );
       if(str_config != NULL ) {
  -        p->tomcat_classpath = p->p.pstrdup(&p->p, str_config);
  +        p->tomcat_classpath = p->pool->pstrdup(p->pool, str_config);
       }
   
       if(!p->tomcat_classpath) {
  @@ -473,7 +472,7 @@
   
       str_config= map_getStrProp( props, "worker", p->name, "jvm_lib", NULL );
       if(str_config != NULL ) {
  -        p->jvm_dll_path  = p->p.pstrdup(&p->p, str_config);
  +        p->jvm_dll_path  = p->pool->pstrdup(p->pool, str_config);
       }
   
       if(!p->jvm_dll_path || !jk_file_exists(p->jvm_dll_path)) {
  @@ -483,29 +482,29 @@
   
       str_config= map_getStrProp( props, "worker", p->name, "cmd_line", NULL ); 
       if(str_config != NULL ) {
  -        p->tomcat_cmd_line  = p->p.pstrdup(&p->p, str_config);
  +        p->tomcat_cmd_line  = p->pool->pstrdup(p->pool, str_config);
       }
   
       str_config=  map_getStrProp( props, "worker", p->name, "stdout", NULL ); 
       if(str_config!= NULL ) {
  -        p->stdout_name  = p->p.pstrdup(&p->p, str_config);
  +        p->stdout_name  = p->pool->pstrdup(p->pool, str_config);
       }
   
       str_config=  map_getStrProp( props, "worker", p->name, "stderr", NULL ); 
       if(str_config!= NULL ) {
  -        p->stderr_name  = p->p.pstrdup(&p->p, str_config);
  +        p->stderr_name  = p->pool->pstrdup(p->pool, str_config);
       }
   
       str_config=  map_getStrProp( props, "worker", p->name, "sysprops", NULL ); 
       if(str_config!= NULL ) {
  -        p->sysprops  = jk_parse_sysprops(&p->p, str_config);
  +        p->sysprops  = jk_parse_sysprops(p->pool, str_config);
       }
   
   #ifdef JNI_VERSION_1_2
       str_config= map_getStrProp( props, "worker", p->name, "java2opts", NULL );
       if( str_config != NULL ) {
       	/* l->jkLog(l, JK_LOG_DEBUG, "Got opts: %s\n", str_config); */
  -        p->java2opts = jk_parse_sysprops(&p->p, str_config);
  +        p->java2opts = jk_parse_sysprops(p->pool, str_config);
       }
       mem_config= map_getIntProp( props, "worker", p->name, "java2lax", -1 );
       if(mem_config != -1 ) {
  @@ -515,7 +514,7 @@
   
       str_config=  map_getStrProp( props, "worker", p->name, "ld_path", NULL ); 
       if(str_config!= NULL ) {
  -        jk_append_libpath(&p->p, str_config);
  +        jk_append_libpath(p->pool, str_config);
       }
   
       if(!load_jvm_dll(p, l)) {
  @@ -699,7 +698,7 @@
           detach_from_jvm(p, l);
       }
   
  -    p->p.close(&p->p);
  +    p->pool->close(p->pool);
       free(p);
   
       l->jkLog(l, JK_LOG_DEBUG, "Done destroy\n");
  @@ -707,7 +706,7 @@
       return JK_TRUE;
   }
   
  -int JK_METHOD jk_worker_jni_factory(jk_env_t *env, void **result,
  +int JK_METHOD jk_worker_jni_factory(jk_env_t *env, jk_pool_t *pool, void **result,
                                       char *type, char *name)
   {
       jk_logger_t *l=env->logger;
  @@ -728,7 +727,7 @@
           return JK_TRUE;
       }
   
  -    private_data = (jni_worker_t *)malloc(sizeof(jni_worker_t ));
  +    private_data = (jni_worker_t *)pool->calloc(pool, sizeof(jni_worker_t ));
   
       if(!private_data) {
   	    l->jkLog(l, JK_LOG_ERROR, 
  @@ -736,16 +735,14 @@
   	    return JK_FALSE;
       }
   
  -    jk_open_pool(&private_data->p,
  -                 private_data->buf,
  -                 sizeof(jk_pool_atom_t) * TINY_POOL_SIZE);
  -
  -    private_data->name = private_data->p.pstrdup(&private_data->p, name);
  +    private_data->pool=pool;
  +    
  +    private_data->name = private_data->pool->pstrdup(private_data->pool, name);
   
       if(!private_data->name) {
           l->jkLog(l, JK_LOG_ERROR, 
                    "In jni_worker_factory, memory allocation error\n");
  -        private_data->p.close(&private_data->p);
  +        private_data->pool->close(private_data->pool);
           free(private_data);
           return JK_FALSE;
       }
  @@ -780,6 +777,7 @@
   
       *result = &private_data->worker;
       the_singleton_jni_worker = &private_data->worker;
  +    private_data->worker.pool=pool;
   
       l->jkLog(l, JK_LOG_DEBUG, "Done jni_worker_factory\n");
       return JK_TRUE;
  @@ -908,7 +906,7 @@
           unsigned len = strlen(vm_args.classpath) + 
                          strlen(p->tomcat_classpath) + 
                          3;
  -        char *tmp = p->p.alloc(&p->p, len);
  +        char *tmp = p->pool->alloc(p->pool, len);
           if(tmp) {
               sprintf(tmp, "%s%c%s", 
                       p->tomcat_classpath, 
  @@ -1047,21 +1045,21 @@
   
       if(p->tomcat_classpath) {
       	l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting classpath to %s\n", p->tomcat_classpath);
  -	    tmp = build_opt_str(&p->p, "-Djava.class.path=", p->tomcat_classpath, l);
  +	    tmp = build_opt_str(p->pool, "-Djava.class.path=", p->tomcat_classpath, l);
   	    null_check(tmp);
           options[optn++].optionString = tmp;
       }
   
       if(p->tomcat_mx) {
   	    l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting max heap to %d\n", p->tomcat_mx);
  -    	tmp = build_opt_int(&p->p, "-Xmx", p->tomcat_mx, l);
  +    	tmp = build_opt_int(p->pool, "-Xmx", p->tomcat_mx, l);
   	    null_check(tmp);
           options[optn++].optionString = tmp;
       }
   
       if(p->tomcat_ms) {
       	l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting start heap to %d\n", p->tomcat_ms);
  -        tmp = build_opt_int(&p->p, "-Xms", p->tomcat_ms, l);
  +        tmp = build_opt_int(p->pool, "-Xms", p->tomcat_ms, l);
   	    null_check(tmp);
           options[optn++].optionString = tmp;
       }
  @@ -1070,7 +1068,7 @@
   	    int i = 0;
   	    while(p->sysprops[i]) {
   	        l->jkLog(l, JK_LOG_DEBUG, "In open_jvm2, setting %s\n", p->sysprops[i]);
  -	        tmp = build_opt_str(&p->p, "-D", p->sysprops[i], l);
  +	        tmp = build_opt_str(p->pool, "-D", p->sysprops[i], l);
   	        null_check(tmp);
   	        options[optn++].optionString = tmp;
   	        i++;
  
  
  
  1.5       +33 -29    jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c
  
  Index: jk_channel_socket.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_channel_socket.c	2001/12/05 20:48:20	1.4
  +++ jk_channel_socket.c	2001/12/06 22:54:44	1.5
  @@ -80,6 +80,8 @@
   	#define closesocket			close
   #endif
   
  +#define DEFAULT_HOST "127.0.0.1"
  +
   /** Information specific for the socket channel
    */
   struct jk_channel_socket_private {
  @@ -105,8 +107,9 @@
     XXX We could also use properties or 'notes'
   */
   
  -int JK_METHOD jk_channel_socket_factory(jk_env_t *env, void **result,
  -					char *type, char *name);
  +int JK_METHOD jk_channel_socket_factory(jk_env_t *env, jk_pool_t *pool,
  +                                        void **result,
  +					const char *type, const char *name);
   
   static int JK_METHOD jk_channel_socket_resolve(char *host, short port,
   				     struct sockaddr_in *rc);
  @@ -156,8 +159,10 @@
       host = map_getStrProp( props, "worker", worker_name, "host", host);
   
       _this->worker=worker;
  -    _this->logger=l;
       _this->properties=props;
  +
  +    if( host==NULL )
  +        host=DEFAULT_HOST;
       
       err=jk_channel_socket_resolve( host, port, rc );
       if( err!= JK_TRUE ) {
  @@ -226,7 +231,7 @@
   static int JK_METHOD jk_channel_socket_open(jk_channel_t *_this,
                                               jk_endpoint_t *endpoint)
   {
  -    jk_logger_t *l=_this->logger;
  +    jk_logger_t *l=_this->worker->workerEnv->l;
       int err=l->jkLog(l, JK_LOG_DEBUG, "Into jk_channel_socket_open\n");
       jk_channel_socket_private_t *socketInfo=
   	(jk_channel_socket_private_t *)(_this->_privatePtr);
  @@ -394,39 +399,38 @@
   
   
   
  -int JK_METHOD jk_channel_socket_factory(jk_env_t *env,
  -                                        void **result,
  -					char *type,
  -                                        char *name)
  +int JK_METHOD jk_channel_socket_factory(jk_env_t *env, jk_pool_t *pool, void **result,
  +					const char *type, const char *name)
   {
  -    jk_channel_t *channel;
  +    jk_channel_t *_this;
       
       if( strcmp( "channel", type ) != 0 ) {
   	/* Wrong type  XXX throw */
   	*result=NULL;
   	return JK_FALSE;
       }
  -    channel=(jk_channel_t *)malloc( sizeof( jk_channel_t));
  -    channel->_privatePtr= (jk_channel_socket_private_t *)
  -	malloc( sizeof( jk_channel_socket_private_t));
  -
  -    channel->recv= &jk_channel_socket_recv; 
  -    channel->send= &jk_channel_socket_send; 
  -    channel->init= &jk_channel_socket_init; 
  -    channel->open= &jk_channel_socket_open; 
  -    channel->close= &jk_channel_socket_close; 
  -    channel->getProperty= &jk_channel_socket_getProperty; 
  -    channel->setProperty= &jk_channel_socket_setProperty; 
  -
  -    channel->supportedProperties=( char ** )malloc( 4 * sizeof( char * ));
  -    channel->supportedProperties[0]="host";
  -    channel->supportedProperties[1]="port";
  -    channel->supportedProperties[2]="defaultPort";
  -    channel->supportedProperties[3]="\0";
  -
  -    channel->name="file";
  +    _this=(jk_channel_t *)pool->alloc(pool, sizeof( jk_channel_t));
       
  -    *result= channel;
  +    _this->_privatePtr= (jk_channel_socket_private_t *)
  +	pool->alloc( pool, sizeof( jk_channel_socket_private_t));
  +
  +    _this->recv= &jk_channel_socket_recv; 
  +    _this->send= &jk_channel_socket_send; 
  +    _this->init= &jk_channel_socket_init; 
  +    _this->open= &jk_channel_socket_open; 
  +    _this->close= &jk_channel_socket_close; 
  +    _this->getProperty= &jk_channel_socket_getProperty; 
  +    _this->setProperty= &jk_channel_socket_setProperty; 
  +
  +    _this->supportedProperties=( char ** )pool->alloc( pool, 4 * sizeof( char * ));
  +    _this->supportedProperties[0]="host";
  +    _this->supportedProperties[1]="port";
  +    _this->supportedProperties[2]="defaultPort";
  +    _this->supportedProperties[3]="\0";
  +
  +    _this->name="file";
  +
  +    *result= _this;
       
       return JK_TRUE;
   }
  
  
  
  1.4       +5 -4      jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c
  
  Index: jk_endpoint.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_endpoint.c	2001/12/05 20:48:20	1.3
  +++ jk_endpoint.c	2001/12/06 22:54:44	1.4
  @@ -59,7 +59,7 @@
    * Description: common stuff for bi-directional protocols ajp13/ajp14.     *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Author:      Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.3 $                                           *
  + * Version:     $Revision: 1.4 $                                           *
    ***************************************************************************/
   
   
  @@ -86,7 +86,7 @@
   void ajp_reset_endpoint(jk_endpoint_t *ae)
   {
       ae->reuse = JK_FALSE;
  -    ae->pool.reset( &ae->pool );
  +    ae->pool->reset( ae->pool );
   }
   
   /*
  @@ -98,7 +98,7 @@
       l->jkLog(l, JK_LOG_DEBUG, "In jk_endpoint_t::ajp_close_endpoint\n");
   
       ajp_reset_endpoint(ae);
  -    ae->pool.close( &ae->pool );
  +    ae->pool->close( ae->pool );
       {
   	jk_channel_t *channel=ae->worker->channel;
   	int err=channel->close( channel, ae );
  @@ -429,7 +429,7 @@
   
       switch(code) {
       case JK_AJP13_SEND_HEADERS:
  -        err=ajp_handle_response( msg, r, ae, l );
  +        err=ajp_handle_startResponse( msg, r, ae, l );
           return err;
           break;
           
  @@ -511,6 +511,7 @@
               l->jkLog(l, JK_LOG_ERROR, "Error reading reply\n");
               /* we just can't recover, unset recover flag */
               return JK_FALSE;
  +
           }
           
           rc = ajp_process_callback(e->reply, e->post, e, s, l);
  
  
  
  1.4       +7 -6      jakarta-tomcat-connectors/jk/native2/common/jk_env.c
  
  Index: jk_env.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_env.c	2001/12/05 20:48:20	1.3
  +++ jk_env.c	2001/12/06 22:54:44	1.4
  @@ -68,9 +68,10 @@
      The env will provide access to pools, etc 
   */
   
  -jk_env_t* JK_METHOD jk_env_getEnv( char *id ) {
  +jk_env_t* JK_METHOD jk_env_getEnv( char *id, jk_pool_t *pool ) {
     if( jk_env_singleton == NULL ) {
  -    jk_env_singleton=(jk_env_t *)calloc( 1, sizeof( jk_env_t ));
  +    jk_env_singleton=(jk_env_t *)pool->calloc( pool, sizeof( jk_env_t ));
  +    jk_env_singleton->globalPool = pool;
       jk_env_initEnv( (jk_env_t *)jk_env_singleton, id );
     }
     return jk_env_singleton;
  @@ -101,7 +102,7 @@
     return result;
   }
   
  -static void *jk_env_getInstance( jk_env_t *_this, const char *type, const char *name )
  +static void *jk_env_getInstance( jk_env_t *_this, jk_pool_t *pool, const char *type, const
char *name )
   {
       jk_env_objectFactory_t fac;
       void *result;
  @@ -114,7 +115,7 @@
           return NULL;
       }
   
  -    fac( _this, &result, type, name );
  +    fac( _this, pool, &result, type, name );
       if( result==NULL ) {
           if( _this->logger )
               _this->logger->jkLog(_this->logger, JK_LOG_ERROR,
  @@ -135,7 +136,7 @@
     char *typeName;
     int size=( sizeof( char ) * (strlen(name) + strlen(type) + 2 ));
   
  -  typeName=(char *)calloc(size, sizeof(char));
  +  typeName=(char *)env->globalPool->calloc(env->globalPool, size);
   
   
     strcpy(typeName, type );
  @@ -150,7 +151,7 @@
     env->getFactory= jk_env_getFactory; 
     env->registerFactory= jk_env_registerFactory;
     env->getInstance= jk_env_getInstance; 
  -  map_alloc( & env->_registry);
  +  map_alloc( & env->_registry, env->globalPool );
     jk_registry_init(env);
   }
   
  
  
  
  1.5       +2 -2      jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c
  
  Index: jk_handler_logon.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_logon.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jk_handler_logon.c	2001/12/05 20:48:20	1.4
  +++ jk_handler_logon.c	2001/12/06 22:54:44	1.5
  @@ -58,7 +58,7 @@
   /**
    * Description: AJP14 Login handler
    * Author:      Henri Gomez <hgomez@slib.fr>
  - * Version:     $Revision: 1.4 $                                          
  + * Version:     $Revision: 1.5 $                                          
    */
   
   #include "jk_global.h"
  @@ -224,7 +224,7 @@
   static int jk_handler_logon_logon(jk_endpoint_t *ae,
                              jk_logger_t    *l)
   {
  -    jk_pool_t     *p = &ae->pool;
  +    jk_pool_t     *p = ae->pool;
       jk_msg_buf_t  *msg;
       int 	  rc;
       
  
  
  
  1.4       +1 -1      jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c
  
  Index: jk_handler_response.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_handler_response.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_handler_response.c	2001/12/05 20:48:20	1.3
  +++ jk_handler_response.c	2001/12/06 22:54:44	1.4
  @@ -190,7 +190,7 @@
                                     jk_endpoint_t *ae,
                                     jk_logger_t    *l)
   {
  -    jk_pool_t * p = &ae->pool;
  +    jk_pool_t * p = ae->pool;
   
       s->status = jk_b_get_int(msg);
   
  
  
  
  1.6       +17 -7     jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_lb_worker.c	2001/12/05 20:46:47	1.5
  +++ jk_lb_worker.c	2001/12/06 22:54:44	1.6
  @@ -60,7 +60,7 @@
    *              several workers.                                           *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Based on:                                                               *
  - * Version:     $Revision: 1.5 $                                           *
  + * Version:     $Revision: 1.6 $                                           *
    ***************************************************************************/
   
   #include "jk_pool.h"
  @@ -78,6 +78,7 @@
   #define ADDITINAL_WAIT_LOAD (20)
   
   int JK_METHOD jk_worker_lb_factory(jk_env_t *env,
  +                                   jk_pool_t *pool,
                                      void **result,
                                      char *type,
                                      char *name);
  @@ -348,27 +349,33 @@
       return JK_TRUE;
   }
   
  -static int JK_METHOD get_endpoint(jk_worker_t *pThis,
  +static int JK_METHOD get_endpoint(jk_worker_t *_this,
                                     jk_endpoint_t **pend,
                                     jk_logger_t *l)
   {
       jk_endpoint_t *e;
  +    jk_pool_t *endpointPool;
       
       l->jkLog(l, JK_LOG_DEBUG, "lb_worker.getEndpoint()\n");
   
  -    if(pThis==NULL || pend==NULL ) {        
  +    if(_this==NULL || pend==NULL ) {        
           l->jkLog(l, JK_LOG_ERROR, 
                  "lb_worker.getEndpoint() NPE\n");
       }
   
  -    e = (jk_endpoint_t *)malloc(sizeof(jk_endpoint_t));
  +    endpointPool=_this->pool->create( _this->pool, HUGE_POOL_SIZE);
  +    
  +    e = (jk_endpoint_t *)endpointPool->calloc(endpointPool,
  +                                              sizeof(jk_endpoint_t));
       if(e==NULL) {
           l->jkLog(l, JK_LOG_ERROR, 
                    "lb_worker.getEndpoint() OutOfMemoryException\n");
           return JK_FALSE;
       }
  +
  +    e->pool = endpointPool;
       
  -    e->worker = pThis;
  +    e->worker = _this;
       e->service = service;
       e->done = done;
       e->channelData = NULL;
  @@ -403,6 +410,7 @@
   
   
   int JK_METHOD jk_worker_lb_factory(jk_env_t *env,
  +                                   jk_pool_t *pool,
                                      void **result,
                                      char *type,
                                      char *name)
  @@ -412,17 +420,19 @@
       
       l->jkLog(l, JK_LOG_DEBUG, "lb_worker.factory()\n");
   
  -    if(NULL != name ) {
  +    if(NULL == name ) {
           l->jkLog(l, JK_LOG_ERROR,"lb_worker.factory() NullPointerException\n");
           return JK_FALSE;
       }
       
  -    _this = (jk_worker_t *)malloc(sizeof(jk_worker_t));
  +    _this = (jk_worker_t *)pool->calloc(pool, sizeof(jk_worker_t));
   
       if(_this==NULL) {
           l->jkLog(l, JK_LOG_ERROR,"lb_worker.factory() OutOfMemoryException\n");
           return JK_FALSE;
       }
  +
  +    _this->pool=pool;
   
       _this->lb_workers = NULL;
       _this->num_of_workers = 0;
  
  
  

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


Mime
View raw message