Navigation



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

Store redirect information for ALL_SESSION and ALL_USER in a hash.

This is a speedup if many of these exist (compared to checking a
linked list for matches as before).

Refactor a bit while here.

Use the uthash code from Troy D. Hanson,
http://troydhanson.github.com/uthash/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_redirect/rt_redir.c

    r1259 r1260  
    11/*********************************************************************************************************
    22* Software License Agreement (BSD License)                                                               *
    3 * Author: Sebastien Decugis <sdecugis@freediameter.net>                                                  *
     3* Authors: Sebastien Decugis <sdecugis@freediameter.net>                                                 *
     4* and Thomas Klausner <tk@giga.or.at>                                                                    *
    45*                                                                                                        *
    5 * Copyright (c) 2011, WIDE Project and NICT                                                              *
     6* Copyright (c) 2011, 2014, WIDE Project and NICT                                                        *
    67* All rights reserved.                                                                                   *
    78*                                                                                                        *
     
    7273void fd_ext_fini(void)
    7374{
    74         int i;
    75 
    7675        /* Unregister the callbacks */
    7776        if (fwd_hdl) {
     
    8685
    8786        /* Empty all entries */
    88         CHECK_POSIX_DO( pthread_mutex_lock(&redir_exp_peer_lock),   );
    89         for (i = 0; i <= H_U_MAX; i++) {
    90                 CHECK_POSIX_DO( pthread_rwlock_wrlock( &redirects_usages[i].lock), );
    91                 while (!FD_IS_LIST_EMPTY(&redirects_usages[i].sentinel)) {
    92                         struct redir_entry * e = redirects_usages[i].sentinel.next->o;
    93                         fd_list_unlink(&e->redir_list);
    94                         CHECK_FCT_DO( redir_entry_destroy(e), );
    95                 }
    96                 CHECK_POSIX_DO( pthread_rwlock_unlock( &redirects_usages[i].lock), );
    97                 CHECK_POSIX_DO( pthread_rwlock_destroy( &redirects_usages[i].lock), );
    98         }
    99         CHECK_POSIX_DO( pthread_mutex_unlock(&redir_exp_peer_lock),   );
     87        redir_entry_fini();
    10088
    10189        return;
Note: See TracChangeset for help on using the changeset viewer.