Navigation



Ignore:
Timestamp:
Mar 24, 2014, 9:13:38 PM (10 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

Remove whitespace at end of line.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_redirect/redir_expiry.c

    r740 r1259  
    4141/* Entries by their ascending expiration date, to accelerate the work of the expire thread */
    4242static struct fd_list  expire_list = FD_LIST_INITIALIZER(expire_list);
    43 static pthread_cond_t  exp_cnd  = PTHREAD_COND_INITIALIZER; 
     43static pthread_cond_t  exp_cnd  = PTHREAD_COND_INITIALIZER;
    4444
    4545pthread_mutex_t redir_exp_peer_lock = PTHREAD_MUTEX_INITIALIZER;
    4646
    4747/* The thread that handles expired entries cleanup. */
    48 void * redir_exp_thr_fct(void * arg) 
     48void * redir_exp_thr_fct(void * arg)
    4949{
    5050        fd_log_threadname ( "Redirects/expire" );
     
    5353        CHECK_POSIX_DO( pthread_mutex_lock(&redir_exp_peer_lock),  goto fatal_error );
    5454        pthread_cleanup_push( fd_cleanup_mutex, &redir_exp_peer_lock );
    55        
     55
    5656        do {
    5757                struct timespec now;
    5858                struct redir_entry * first;
    59 again:         
     59again:
    6060                /* Check if there are expiring entries available */
    6161                if (FD_IS_LIST_EMPTY(&expire_list)) {
     
    6565                        goto again;
    6666                }
    67                
     67
    6868                /* Get the pointer to the entry that expires first */
    6969                first = (struct redir_entry *)(expire_list.next->o);
    70                
     70
    7171                /* Get the current time */
    7272                CHECK_SYS_DO(  clock_gettime(CLOCK_REALTIME, &now),  break  );
     
    7474                /* If first session is not expired, we just wait until it happens */
    7575                if ( TS_IS_INFERIOR( &now, &first->timeout ) ) {
    76                        
    77                         CHECK_POSIX_DO2(  pthread_cond_timedwait( &exp_cnd, &redir_exp_peer_lock, &first->timeout ), 
     76
     77                        CHECK_POSIX_DO2(  pthread_cond_timedwait( &exp_cnd, &redir_exp_peer_lock, &first->timeout ),
    7878                                        ETIMEDOUT, /* ETIMEDOUT is a normal error, continue */,
    7979                                        /* on other error, */ break );
    80        
     80
    8181                        /* on wakeup, loop */
    8282                        goto again;
    8383                }
    84                
     84
    8585                /* Now, the first entry in the list is expired; destroy it */
    86                
     86
    8787                CHECK_FCT_DO( redir_entry_destroy( first ), break );
    88                
     88
    8989        } while (1);
    90        
     90
    9191        pthread_cleanup_pop( 0 );
    9292        CHECK_POSIX_DO( pthread_mutex_unlock(&redir_exp_peer_lock),  );
    93        
     93
    9494fatal_error:
    9595        TRACE_DEBUG(INFO, "A system error occurred in redirect module! Expiry thread is terminating...");
     
    104104        TRACE_ENTRY("%p %d", e, duration);
    105105        CHECK_PARAMS(e && (e->eyec == REDIR_ENTRY_EYEC) && duration );
    106        
     106
    107107        /* Unlink in case it was already set before */
    108108        fd_list_unlink(&e->exp_list);
    109        
     109
    110110        /* Get current time */
    111111        CHECK_SYS(  clock_gettime(CLOCK_REALTIME, &e->timeout)  );
    112        
     112
    113113        /* Add the duration */
    114114        e->timeout.tv_sec += duration;
    115        
     115
    116116        /* now search the next element in the list */
    117117        for (li = expire_list.next; li != &expire_list; li = li->next) {
    118118                struct redir_entry * n = li->o;
    119                
     119
    120120                if ( TS_IS_INFERIOR( &e->timeout, &n->timeout ) )
    121121                        break;
    122        
     122
    123123        }
    124        
     124
    125125        /* Insert before this element */
    126126        fd_list_insert_before(li, &e->exp_list);
    127        
     127
    128128        /* Signal the expiry thread if needed */
    129129        if (e->exp_list.prev == &expire_list) { /* it is the first element */
    130130                CHECK_POSIX( pthread_cond_signal(&exp_cnd) );
    131131        }
    132        
     132
    133133        /* Done */
    134134        return 0;
Note: See TracChangeset for help on using the changeset viewer.