Changeset 1811

Show
Ignore:
Timestamp:
04/19/2007 09:06:44 PM (17 months ago)
Author:
jan
Message:

fixed the reset of the conditional cache in mod-magnet

Location:
trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/configfile-glue.c

    r1810 r1811  
    534534} 
    535535 
    536 void config_cond_cache_reset(server *srv, connection *con) { 
    537         size_t i; 
    538  
    539         for (i = 0; i < srv->config_context->used - 1; i++) { 
    540                 con->cond_cache[i].result = COND_RESULT_UNSET; 
    541                 con->cond_cache[i].patterncount = 0; 
    542                 con->cond_cache[i].comp_value = NULL; 
    543         } 
    544  
    545         for (i = 0; i < COMP_LAST_ELEMENT; i++) { 
    546                 con->conditional_is_valid[i] = 0; 
    547         } 
    548 } 
    549  
     536/** 
     537 * reset the config-cache for a named item 
     538 * 
     539 * if the item is COND_LAST_ELEMENT we reset all items 
     540 */ 
    550541void config_cond_cache_reset_item(server *srv, connection *con, comp_key_t item) { 
    551542        size_t i; 
    552543 
    553544        for (i = 0; i < srv->config_context->used; i++) { 
    554                 if (con->cond_cache[i].comp_type == item) { 
     545                if (item == COMP_LAST_ELEMENT ||  
     546                    con->cond_cache[i].comp_type == item) { 
    555547                        con->cond_cache[i].result = COND_RESULT_UNSET; 
    556548                        con->cond_cache[i].patterncount = 0; 
     
    560552} 
    561553 
     554/** 
     555 * reset the config cache to its initial state at connection start 
     556 */ 
     557void config_cond_cache_reset(server *srv, connection *con) { 
     558        size_t i; 
     559 
     560        config_cond_cache_reset_all_items(srv, con); 
     561 
     562        for (i = 0; i < COMP_LAST_ELEMENT; i++) { 
     563                con->conditional_is_valid[i] = 0; 
     564        } 
     565} 
    562566 
    563567int config_check_cond(server *srv, connection *con, data_config *dc) { 
  • trunk/src/configfile.h

    r1810 r1811  
    2525LI_API void config_cond_cache_reset_item(server *srv, connection *con, comp_key_t item); 
    2626 
     27#define config_cond_cache_reset_all_items(srv, con) \ 
     28        config_cond_cache_reset_item(srv, con, COMP_LAST_ELEMENT); 
     29 
    2730#endif 
  • trunk/src/mod_magnet.c

    r1810 r1811  
    835835 
    836836        /* reset conditional cache. */ 
    837         for (i = 0; i < COMP_LAST_ELEMENT; i++) { 
    838                 config_cond_cache_reset_item(srv, con, i); 
    839         } 
     837        config_cond_cache_reset_all_items(srv, con); 
    840838 
    841839        return ret;