perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl modperl_callback.c modperl_config.c modperl_config.h modperl_interp.c modperl_types.h
Date Mon, 05 Nov 2001 05:19:01 GMT
dougm       01/11/04 21:19:01

  Modified:    lib/ModPerl Code.pm
               src/modules/perl modperl_callback.c modperl_config.c
                        modperl_config.h modperl_interp.c modperl_types.h
  Log:
  add a per-request cleanup function that properly deals with PerlInterpScope
  
  Revision  Changes    Path
  1.71      +1 -1      modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- Code.pm	2001/09/28 15:16:06	1.70
  +++ Code.pm	2001/11/05 05:19:01	1.71
  @@ -96,7 +96,7 @@
       Srv => ['NONE', @ithread_opts, qw(ENABLE AUTOLOAD MERGE_HANDLERS),
               @hook_flags, 'UNSET'],
       Dir => [qw(NONE PARSE_HEADERS SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)],
  -    Req => [qw(NONE SET_GLOBAL_REQUEST SETUP_ENV)],
  +    Req => [qw(NONE SET_GLOBAL_REQUEST SETUP_ENV CLEANUP_REGISTERED)],
       Interp => [qw(NONE IN_USE PUTBACK CLONED BASE)],
       Handler => [qw(NONE PARSED METHOD OBJECT ANON AUTOLOAD DYNAMIC)],
   );
  
  
  
  1.46      +8 -0      modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- modperl_callback.c	2001/10/06 21:05:40	1.45
  +++ modperl_callback.c	2001/11/05 05:19:01	1.46
  @@ -133,6 +133,14 @@
       }
   #endif
   
  +    /* XXX: would like to do this in modperl_hook_create_request()
  +     * but modperl_interp_select() is what figures out if
  +     * PerlInterpScope eq handler, in which case we do not register
  +     * a cleanup.  modperl_hook_create_request() is also currently always
  +     * run even if modperl isn't handling any part of the request
  +     */
  +    modperl_config_req_cleanup_register(r, rcfg);
  +
       switch (type) {
         case MP_HANDLER_TYPE_PER_DIR:
         case MP_HANDLER_TYPE_PER_SRV:
  
  
  
  1.46      +22 -0     modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- modperl_config.c	2001/10/29 01:19:16	1.45
  +++ modperl_config.c	2001/11/05 05:19:01	1.46
  @@ -227,6 +227,28 @@
       return mrg;
   }
   
  +/* any per-request cleanup goes here */
  +
  +apr_status_t modperl_config_request_cleanup(pTHX_ request_rec *r)
  +{
  +    MP_dRCFG;
  +
  +    if (rcfg->pnotes) {
  +        SvREFCNT_dec(rcfg->pnotes);
  +        rcfg->pnotes = Nullhv;
  +    }
  +
  +    return APR_SUCCESS;
  +}
  +
  +apr_status_t modperl_config_req_cleanup(void *data)
  +{
  +    request_rec *r = (request_rec *)data;
  +    MP_dTHX;
  +
  +    return modperl_config_request_cleanup(aTHX_ r);
  +}
  +
   void *modperl_get_perl_module_config(ap_conf_vector_t *cv)
   {
       return ap_get_module_config(cv, &perl_module);
  
  
  
  1.30      +13 -0     modperl-2.0/src/modules/perl/modperl_config.h
  
  Index: modperl_config.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- modperl_config.h	2001/10/22 17:20:11	1.29
  +++ modperl_config.h	2001/11/05 05:19:01	1.30
  @@ -20,6 +20,19 @@
   #define modperl_config_srv_argv_push(arg) \
       *(const char **)apr_array_push(scfg->argv) = arg
   
  +apr_status_t modperl_config_request_cleanup(pTHX_ request_rec *r);
  +
  +apr_status_t modperl_config_req_cleanup(void *data);
  +
  +#define modperl_config_req_cleanup_register(r, rcfg) \
  +    if (r && !MpReqCLEANUP_REGISTERED(rcfg)) { \
  +        apr_pool_cleanup_register(r->pool, \
  +                                  (void*)r, \
  +                                   modperl_config_req_cleanup, \
  +                                   apr_pool_cleanup_null); \
  +        MpReqCLEANUP_REGISTERED_On(rcfg); \
  +    }
  +
   void *modperl_get_perl_module_config(ap_conf_vector_t *cv);
   void modperl_set_perl_module_config(ap_conf_vector_t *cv, void *cfg);
   
  
  
  
  1.38      +10 -0     modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- modperl_interp.c	2001/11/01 23:50:32	1.37
  +++ modperl_interp.c	2001/11/05 05:19:01	1.38
  @@ -222,6 +222,14 @@
       modperl_interp_t *interp = (modperl_interp_t *)data;
       modperl_interp_pool_t *mip = interp->mip;
   
  +    if (interp->request) {
  +        /* ithreads + a threaded mpm + PerlInterpScope handler */
  +        request_rec *r = interp->request;
  +        MP_dRCFG;
  +        modperl_config_request_cleanup(interp->perl, r);
  +        MpReqCLEANUP_REGISTERED_Off(rcfg);
  +    }
  +
       MpInterpIN_USE_Off(interp);
       MpInterpPUTBACK_Off(interp);
   
  @@ -351,6 +359,8 @@
   
       if (scope == MP_INTERP_SCOPE_HANDLER) {
           /* caller is responsible for calling modperl_interp_unselect() */
  +        interp->request = r;
  +        MpReqCLEANUP_REGISTERED_On(rcfg);
           MpInterpPUTBACK_On(interp);
       }
       else {
  
  
  
  1.53      +1 -0      modperl-2.0/src/modules/perl/modperl_types.h
  
  Index: modperl_types.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- modperl_types.h	2001/10/19 16:40:44	1.52
  +++ modperl_types.h	2001/11/05 05:19:01	1.53
  @@ -42,6 +42,7 @@
       PerlInterpreter *perl;
       int num_requests;
       U8 flags;
  +    request_rec *request;
   #ifdef MP_TRACE
       unsigned long tid;
   #endif
  
  
  

Mime
View raw message