Changeset 9300

Show
Ignore:
Timestamp:
04/27/12 14:34:08 (13 months ago)
Author:
denton
Message:

Corrected timeval errors. Added conditionals to check if the dynamic portions of the acache payload need to be updated based on timestamps.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/acache_improvement/src/client/sysint/acache.c

    r9299 r9300  
    3131#define STATIC_ACACHE_DEFAULT_TIMEOUT_MSECS 18000000    /* 5 hours      */ 
    3232#define DYNAMIC_ACACHE_DEFAULT_TIMEOUT_MSECS 5000       /* 5 seconds    */ 
    33 #define SECURITY_ACACHE_DEFAUTL_TIMEOUT_MSECS 7200000   /* 2 hours      */ 
     33#define SECURITY_ACACHE_DEFAULT_TIMEOUT_MSECS 7200000   /* 2 hours      */ 
    3434 
    3535 
     
    7070    uint32_t mirror_copies_count; 
    7171 
    72     uint64_t msecs__security; /**< Time when the security attr was refreshed.  */ 
    73     uint64_t msecs__dynamic;  /**< Time when the dynamic attrs were refreshed. */ 
     72    uint64_t msecs_security; /**< Time when the security attr was refreshed.  */ 
     73    uint64_t msecs_dynamic;  /**< Time when the dynamic attrs were refreshed. */ 
    7474}; 
    7575  
     
    352352    /* struct static_payload* tmp_static_payload; */ 
    353353    int status; 
    354  
    355  
    356     /* Get the current time */ 
     354    /* Storage of current time */ 
    357355    struct timeval current_time = { 0, 0}; 
    358356    uint64_t current_time_msecs = 0; 
    359  
    360     gettimeofday(&current_time, NULL); 
    361     
    362     current_time_msecs = current_time.sec * 1000; 
    363     current_time_msecs += current_time.usec / 1000; 
    364   
    365357    /* Flags indicating whether dynamic attrs or security attr have expired. */ 
    366358    unsigned char security_expired = 0; 
     
    407399        PINT_perf_count(acache_pc, PERF_ACACHE_HITS, 1, PINT_PERF_ADD); 
    408400        tmp_payload = tmp_entry->payload; 
    409  
    410         /* Check to see if either the security or dynamic attrs have expired. 
    411         if() 
    412         { 
    413             security_expired = 1; 
    414         } 
    415  
    416         if() 
    417         { 
    418             dynamic_attrs_expired = 1; 
    419         } 
    420         */ 
    421  
    422401    } 
    423402 
     
    428407        return(ret); 
    429408    } 
    430   
     409 
     410    gettimeofday(&current_time, NULL); 
     411    current_time_msecs = current_time.tv_sec * 1000; 
     412    current_time_msecs += current_time.tv_usec / 1000; 
     413 
     414    /* Check to see if either the security or dynamic attrs have expired. */ 
     415    if((current_time_msecs - tmp_payload->msecs_security) >  
     416        SECURITY_ACACHE_DEFAULT_TIMEOUT_MSECS) 
     417    { 
     418        security_expired = 1; 
     419 
     420        /* Fetch/update security attr */ 
     421 
     422    } 
     423 
     424    if((current_time_msecs - tmp_payload->msecs_dynamic) > 
     425        DYNAMIC_ACACHE_DEFAULT_TIMEOUT_MSECS) 
     426    { 
     427        dynamic_attrs_expired = 1; 
     428 
     429        /* Fetch/update dynamic attrs */ 
     430 
     431    } 
     432 
     433 
    431434#if 0 
    432435    gossip_debug(GOSSIP_ACACHE_DEBUG, "acache: "