Navigation


Changeset 1259:82280e745a89 in freeDiameter for extensions


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.

Location:
extensions/rt_redirect
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_redirect/redir_entries.c

    r740 r1259  
    4343{
    4444        int i;
    45        
     45
    4646        TRACE_ENTRY("");
    47        
     47
    4848        /* redirects_usages */
    4949        memset(&redirects_usages, 0, sizeof(redirects_usages));
    50        
     50
    5151        for (i = 0; i <= H_U_MAX; i++) {
    5252                CHECK_POSIX( pthread_rwlock_init( &redirects_usages[i].lock, NULL) );
    5353                fd_list_init( &redirects_usages[i].sentinel, &redirects_usages[i] );
    5454        }
    55        
     55
    5656        /* initialize the scores */
    5757        redirects_usages[ DONT_CACHE            ].score = FD_SCORE_REDIR_ONCE;
     
    7373        os0_t s;
    7474        size_t l;
    75        
     75
    7676        TRACE_ENTRY("%p %p %d %p %p %zd %p %zd", e, targets, rhu, qry, nh, nhlen, oh, ohlen)
    7777        ASSERT(e && targets && (rhu <= H_U_MAX) && qry && nh && nhlen && oh && ohlen);
    78        
     78
    7979        CHECK_MALLOC( entry = malloc(sizeof(struct redir_entry)) );
    8080        memset(entry, 0, sizeof(struct redir_entry));
    81        
     81
    8282        entry->eyec = REDIR_ENTRY_EYEC;
    83        
     83
    8484        CHECK_MALLOC( entry->from.s = os0dup(nh, nhlen) );
    8585        entry->from.l = nhlen;
    86        
     86
    8787        fd_list_init(&entry->target_peers_list, entry);
    8888        fd_list_move_end(&entry->target_peers_list, targets);
    89        
     89
    9090        fd_list_init(&entry->exp_list, entry);
    91        
     91
    9292        entry->type = rhu;
    9393        fd_list_init(&entry->redir_list, entry);
     
    9797                        entry->data.message.msg = qry;
    9898                        break;
    99                        
     99
    100100                case ALL_SESSION:
    101101                        {
     
    114114                        }
    115115                        break;
    116                
     116
    117117                case ALL_REALM:
    118118                        {
     
    132132                        }
    133133                        break;
    134                                
     134
    135135                case REALM_AND_APPLICATION:
    136136                        {
     
    156156                        }
    157157                        break;
    158                                
     158
    159159                case ALL_APPLICATION:
    160160                        {
     
    164164                        }
    165165                        break;
    166                        
     166
    167167                case ALL_HOST:
    168168                        CHECK_MALLOC( entry->data.host.s = os0dup(oh, ohlen) );
    169169                        entry->data.host.l = ohlen;
    170170                        break;
    171                        
     171
    172172                case ALL_USER:
    173173                        {
     
    187187                        }
    188188                        break;
    189                
     189
    190190                default:
    191191                        ASSERT(0);
    192192                        return EINVAL;
    193193        }
    194        
     194
    195195        /* We're done */
    196196        *e = entry;
     
    203203        unsigned long v1 = (unsigned long) d1->message.msg;
    204204        unsigned long v2 = (unsigned long) d2->message.msg;
    205         if (v1 > v2) 
     205        if (v1 > v2)
    206206                return 1;
    207207        if (v1 < v2)
     
    211211/* Compare two applications (REALM_AND_APPLICATION and ALL_APPLICATION) */
    212212static int compare_entries_appl(union matchdata * d1, union matchdata * d2) {
    213         if (d1->app.a > d2->app.a) 
     213        if (d1->app.a > d2->app.a)
    214214                return 1;
    215         if (d1->app.a < d2->app.a) 
     215        if (d1->app.a < d2->app.a)
    216216                return -1;
    217217        return 0;
     
    238238{
    239239        struct fd_list * li;
    240        
     240
    241241        TRACE_ENTRY("%p", e);
    242242        CHECK_PARAMS(e && (e->eyec == REDIR_ENTRY_EYEC));
    243        
     243
    244244        /* Write-Lock the line */
    245245        CHECK_POSIX( pthread_rwlock_wrlock( RWLOCK_REDIR(e) ) );
    246        
     246
    247247        for (li = redirects_usages[e->type].sentinel.next; li != &redirects_usages[e->type].sentinel; li = li->next) {
    248248                struct redir_entry * n = li->o;
     
    251251                        break;
    252252        }
    253        
     253
    254254        fd_list_insert_before(li, &e->redir_list);
    255        
     255
    256256        /* unLock the line */
    257257        CHECK_POSIX( pthread_rwlock_unlock( RWLOCK_REDIR(e) ) );
     
    265265        TRACE_ENTRY("%p", e);
    266266        CHECK_PARAMS(e && (e->eyec == REDIR_ENTRY_EYEC));
    267        
     267
    268268        /* If the entry is linked, lock the rwlock also */
    269269        if (!FD_IS_LIST_EMPTY(&e->redir_list)) {
     
    272272                CHECK_POSIX( pthread_rwlock_unlock( RWLOCK_REDIR(e) ) );
    273273        }
    274        
     274
    275275        /* Now unlink from other list */
    276276        fd_list_unlink(&e->exp_list);
    277        
     277
    278278        /* Empty the targets list */
    279279        while (!FD_IS_LIST_EMPTY(&e->target_peers_list)) {
    280280                struct redir_host * h = (struct redir_host *)e->target_peers_list.next->o;
    281                
     281
    282282                fd_list_unlink(&h->chain);
    283283                free(h->id);
    284284                free(h);
    285285        }
    286        
     286
    287287        /* Now we can destroy the data safely */
    288288        switch (e->type) {
     
    312312                        return EINVAL;
    313313        }
    314        
     314
    315315        free(e->from.s);
    316        
     316
    317317        free(e);
    318318        return 0;
  • 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;
  • extensions/rt_redirect/redir_fwd.c

    r1127 r1259  
    5959        int nbrh = 0;
    6060        struct redir_entry * entry;
    61        
     61
    6262        TRACE_ENTRY("%p %p", cbdata, msg);
    63        
     63
    6464        CHECK_PARAMS(msg && *msg);
    65        
     65
    6666        m = *msg;
    67        
     67
    6868        /* First get the header */
    6969        CHECK_FCT( fd_msg_hdr(m, &hdr) );
    70        
     70
    7171        /* Check if we have an error */
    7272        ASSERT(!(hdr->msg_flags & CMD_FLAG_REQUEST));
     
    7575                return 0;
    7676        }
    77        
     77
    7878        /* Now get the AVPs we are interested in */
    7979        CHECK_FCT(  fd_msg_browse(m, MSG_BRW_FIRST_CHILD, &avp, NULL)  );
    8080        while (avp) {
    8181                struct avp_hdr * ahdr;
    82                        
     82
    8383                CHECK_FCT(  fd_msg_avp_hdr( avp, &ahdr )  );
    8484                if (! (ahdr->avp_flags & AVP_FLAG_VENDOR)) {
     
    9090                                        a_oh = ahdr->avp_value;
    9191                                        break;
    92                                        
     92
    9393                                case AC_RESULT_CODE:
    9494                                        /* Parse this AVP */
     
    9696                                        ASSERT( ahdr->avp_value );
    9797                                        a_rc = ahdr->avp_value;
    98                                        
     98
    9999                                        if (a_rc->u32 != ER_DIAMETER_REDIRECT_INDICATION) {
    100100                                                /* It is not a REDIRECT error, we don't do anything */
     
    102102                                        }
    103103                                        break;
    104                                        
     104
    105105                                case AC_REDIRECT_HOST:
    106106                                        {
     
    112112                                                int      l4 = 0;
    113113                                                char     proto = 0;
    114                                                
     114
    115115                                                /* Parse this AVP */
    116116                                                CHECK_FCT( fd_msg_parse_dict ( avp, fd_g_config->cnf_dict, NULL ) );
    117117                                                ASSERT( ahdr->avp_value );
    118                                                
     118
    119119                                                nbrh++;
    120                                                
    121                                                 CHECK_FCT_DO( fd_os_parse_DiameterURI(ahdr->avp_value->os.data, ahdr->avp_value->os.len, 
     120
     121                                                CHECK_FCT_DO( fd_os_parse_DiameterURI(ahdr->avp_value->os.data, ahdr->avp_value->os.len,
    122122                                                                        &id, &len, &secure, &port, &l4, &proto),
    123123                                                        {
     
    125125                                                                break;
    126126                                                        } );
    127                                                
     127
    128128                                                /* Now check if the transport & protocol are supported */
    129129                                                if (proto && (proto != 'd')) {
     
    137137                                                        break;
    138138                                                }
    139                                                
     139
    140140                                                /* It looks OK, save this entry. */
    141                                                
     141
    142142                                                CHECK_MALLOC( h = malloc(sizeof(struct redir_host)) );
    143143                                                memset(h, 0, sizeof(struct redir_host));
     
    146146                                                h->len = len;
    147147                                                /* later: secure, port */
    148                                                
     148
    149149                                                /* The list is kept ordered by id so that it is faster to compare to candidates later */
    150150                                                for (li = task.rh.next; li != &task.rh; li = li->next) {
     
    183183                CHECK_FCT(  fd_msg_browse(avp, MSG_BRW_NEXT, &avp, NULL)  );
    184184        }
    185        
     185
    186186        /* Check we have received the necessary information */
    187187        if (!a_rc) {
     
    189189                goto out;
    190190        }
    191        
     191
    192192        if (!a_oh) {
    193193                TRACE_DEBUG(FULL, "Invalid Diameter answer without an Origin-Host AVP, Redirect module gave up");
    194194                goto out;
    195195        }
    196        
     196
    197197        if (FD_IS_LIST_EMPTY(&task.rh)) {
    198198                TRACE_DEBUG(FULL, "Diameter answer with a DIAMETER_REDIRECT_INDICATION Result-Code AVP but no valid/supported Redirect-Host AVP, Redirect module gave up");
     
    204204                goto out;
    205205        }
    206        
     206
    207207        /* It looks like we can process the Redirect indication */
    208        
     208
    209209        /* Search for the peers we already know */
    210210        for (li = task.rh.next; li != &task.rh; li = li->next) {
    211211                struct redir_host * h = li->o;
    212212                struct peer_hdr * peer;
    213                
     213
    214214                CHECK_FCT( fd_peer_getbyid( h->id, h->len, 1, &peer ) );
    215215                if (peer) {
     
    221221                }
    222222        }
    223        
     223
    224224        TRACE_DEBUG(FULL, "Redirect module: received %d Redirect-Hosts, %d are known peers, %d have an OPEN connection", nbrh, known, actives);
    225        
     225
    226226        /* in this version, we only redirect when there are known active peers. TODO: add new peers via fd_peer_add when no active peer is available */
    227        
     227
    228228        if (!actives) {
    229229                TRACE_DEBUG(INFO, "Unable to comply to Redirect indication: none of the peers included is in OPEN state");
    230230                goto out;
    231231        }
    232        
     232
    233233        /* From this point, we will re-send the query to a different peer, so stop forwarding the answer here */
    234234        *msg = NULL;
    235        
     235
    236236        /* Get the query's routing data & add the new error */
    237237        CHECK_FCT( fd_msg_answ_getq(m, &q) );
     
    239239        CHECK_FCT( fd_msg_source_get( m, &nh, &nhlen ) );
    240240        CHECK_FCT( fd_rtd_error_add(rtd, nh, nhlen, a_oh->os.data, a_oh->os.len, a_rc->u32, NULL, NULL) );
    241        
     241
    242242        /* Create a redir_rule  */
    243243        CHECK_FCT( redir_entry_new(&entry, &task.rh, task.rhu, q, nh, nhlen, a_oh->os.data, a_oh->os.len) );
    244                
     244
    245245        CHECK_POSIX(  pthread_mutex_lock(&redir_exp_peer_lock)  );
    246246        /* Insert in the split list */
     
    253253        CHECK_FCT( fd_msg_answ_detach(m) );
    254254        CHECK_FCT( fd_msg_free(m) );
    255        
     255
    256256        /* Send it */
    257257        CHECK_FCT( fd_msg_send(&q, NULL, NULL) );
    258        
     258
    259259        /* Done! */
    260        
     260
    261261out:
    262262        while (!FD_IS_LIST_EMPTY(&task.rh)) {
     
    266266                free(h);
    267267        }
    268                
     268
    269269        return 0;
    270270
  • extensions/rt_redirect/redir_out.c

    r1216 r1259  
    4141{
    4242        TRACE_ENTRY("%d %p %p %p", type, msg, data, nodata);
    43        
     43
    4444        /* Initialize the data area */
    4545        memset(data, 0, sizeof(union matchdata));
    4646        *nodata = 0;
    47        
     47
    4848        /* Now, find the appropriate information, depending on type */
    4949        switch (type) {
     
    5151                        data->message.msg = msg;
    5252                        break;
    53                        
     53
    5454                case ALL_SESSION:
    5555                        {
     
    6565                        }
    6666                        break;
    67                
     67
    6868                case ALL_REALM:
    6969                        {
     
    8282                        }
    8383                        break;
    84                                
     84
    8585                case REALM_AND_APPLICATION:
    8686                        {
     
    9696                                        data->realm_app.s = ahdr->avp_value->os.data;
    9797                                        data->realm_app.l = ahdr->avp_value->os.len;
    98                                        
     98
    9999                                        /* and then the application */
    100100                                        {
     
    107107                        }
    108108                        break;
    109                                
     109
    110110                case ALL_APPLICATION:
    111111                        {
     
    116116                        }
    117117                        break;
    118                        
     118
    119119                case ALL_HOST:
    120120                                /* This is more complex, we need to match with all candidates in each rule, it'll be done later */
    121121                        break;
    122                        
     122
    123123                case ALL_USER:
    124124                        {
     
    137137                        }
    138138                        break;
    139                
     139
    140140                default:
    141141                        ASSERT(0);
     
    153153        struct rtd_candidate * c_oh = NULL;
    154154        int cmp;
    155        
     155
    156156        TRACE_ENTRY("%p %p %p", e, msg, candidates);
    157157        ASSERT( e && msg && candidates );
    158        
     158
    159159        if (FD_IS_LIST_EMPTY(candidates)) {
    160160                TRACE_DEBUG(ANNOYING, "Skip Redirect rule since candidates list is empty");
    161161                return 0;
    162162        }
    163        
     163
    164164        /* Now search common peers between e->target_peers_list and candidates */
    165165        TRACE_DEBUG(ANNOYING, "Message %p matches a Redirect rule (t:%d, @%p), processing candidates list", msg, e->type, e);
    166        
     166
    167167        /* First, decrease the score of the host that we received the previous Redirect from, in case it is in the list */
    168168        for (lic = candidates->next; lic != candidates; lic = lic->next) {
    169169                struct rtd_candidate * cand = (struct rtd_candidate *) lic;
    170                
     170
    171171                /* Special case: ALL_HOST rules: we decrease the score of the Origin-Host if present */
    172172                if (e->type == ALL_HOST) {
     
    179179                        }
    180180                }
    181                
     181
    182182                cmp = fd_os_cmp(cand->diamid, cand->diamidlen, e->from.s, e->from.l);
    183183                if (!cmp) {
     
    185185                        cand->score += FD_SCORE_SENT_REDIRECT;
    186186                }
    187                
    188         }
    189        
     187
     188        }
     189
    190190        if ((e->type == ALL_HOST) && (c_oh == NULL)) {
    191191                /* The rule does not apply, we're done */
    192192                return 0;
    193193        }
    194        
     194
    195195        /* for each candidate, if it is found in the target_peers list, we add the rule's score to this candidate */
    196196        for (lic = candidates->next; lic != candidates; lic = lic->next) {
    197197                /* the candidates list is not guaranteed to be ordered at this time, so we cannot avoid the two imbricated loops */
    198198                struct rtd_candidate * cand = (struct rtd_candidate *) lic;
    199                
     199
    200200                /* Is this candidate in the "Redirect-Host" list ? We must search caseinsentive here. */
    201201                for (lirh = e->target_peers_list.next; lirh != &e->target_peers_list; lirh = lirh->next) {
    202202                        struct redir_host * host = lirh->o;
    203203                        int cont;
    204                        
     204
    205205                        cmp = fd_os_almostcasesrch( cand->diamid, cand->diamidlen, host->id, host->len, &cont );
    206                        
     206
    207207                        if (cmp == 0) {
    208208                                TRACE_DEBUG(FULL, "Redirect msg %p: peer '%.*s' += %d (rule t:%d @%p)", msg, (int)cand->diamidlen, cand->diamid, redirects_usages[e->type].score, e->type, e);
     
    214214                }
    215215        }
    216        
     216
    217217        return 0;
    218218}
     
    224224        int i, ret = 0;
    225225        struct msg * msg = *pmsg;
    226        
     226
    227227        TRACE_ENTRY("%p %p %p", cbdata, msg, candidates);
    228        
     228
    229229        for (i = 0; i <= H_U_MAX; i++) {
    230230                /* Lock the line. We write lock in case of DONT_CACHE so we can directly unlink the entry. read in other cases is sufficient */
     
    234234                        CHECK_POSIX( pthread_rwlock_rdlock( &redirects_usages[i].lock ) );
    235235                }
    236                
     236
    237237                if (!FD_IS_LIST_EMPTY(&redirects_usages[i].sentinel)) {
    238238                        union matchdata data;
    239239                        int nodata; /* The message does not allow to apply this rule, skip */
    240                        
     240
    241241                        /* Retrieve the data that may match in the message */
    242242                        CHECK_FCT_DO( ret = get_data_to_match(i, msg, &data, &nodata), goto out );
    243                        
     243
    244244                        /* If this message may match some of our rules */
    245245                        if (!nodata) {
     
    248248                                for (li = redirects_usages[i].sentinel.next; li != &redirects_usages[i].sentinel; li = li->next) {
    249249                                        struct redir_entry * e = li->o;
    250                                        
     250
    251251                                        /* Does it match ? */
    252252                                        if (i != ALL_HOST) { /* this one is an exception, we handle it separately */
     
    257257                                                        break;
    258258                                        }
    259                                        
     259
    260260                                        /* This rule matches (or we are in ALL_HOST), apply */
    261261                                        CHECK_FCT_DO( ret = apply_rule(e, msg, candidates), goto out );
    262                                        
     262
    263263                                        /* If this was a DONT_CACHE rule, we unlink it, so that it will not be used again */
    264264                                        if (i == DONT_CACHE) {
    265265                                                li=li->prev;
    266266                                                fd_list_unlink( li->next );
    267                                                 /* We cannot delete here without taking the mutex, which would mean we have first to release the lock... 
     267                                                /* We cannot delete here without taking the mutex, which would mean we have first to release the lock...
    268268                                                        just let expiry garbage collet the rule */
    269269                                        }
    270270                                }
    271271                        }
    272                
    273                 }
    274 out:           
     272
     273                }
     274out:
    275275                CHECK_POSIX( pthread_rwlock_unlock( &redirects_usages[i].lock ) );
    276276                if (ret)
    277277                        return ret;
    278278        }
    279        
     279
    280280        return 0;
    281281}
  • extensions/rt_redirect/rt_redir.c

    r740 r1259  
    4747{
    4848        TRACE_ENTRY("");
    49        
     49
    5050        /* Dictionary objects */
    5151        CHECK_FCT(  fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &redir_dict_dr, ENOENT)  );
     
    5454        /* Initialize the entries array */
    5555        CHECK_FCT( redir_entry_init() );
    56        
     56
    5757        /* Start the expire thread */
    5858        CHECK_POSIX( pthread_create( &exp_thr, NULL, redir_exp_thr_fct, NULL ) );
    59        
     59
    6060        /* Register the callback that receives the answers and processes when it contains a Redirect indication. */
    6161        CHECK_FCT( fd_rt_fwd_register ( redir_fwd_cb, NULL, RT_FWD_ANS, &fwd_hdl ) );
     
    7373{
    7474        int i;
    75        
     75
    7676        /* Unregister the callbacks */
    7777        if (fwd_hdl) {
     
    8181                CHECK_FCT_DO( fd_rt_out_unregister(out_hdl, NULL), );
    8282        }
    83        
     83
    8484        /* Stop the expiry thread */
    8585        CHECK_FCT_DO( fd_thr_term(&exp_thr), );
    86        
     86
    8787        /* Empty all entries */
    8888        CHECK_POSIX_DO( pthread_mutex_lock(&redir_exp_peer_lock),   );
     
    9898        }
    9999        CHECK_POSIX_DO( pthread_mutex_unlock(&redir_exp_peer_lock),   );
    100        
     100
    101101        return;
    102102}
  • extensions/rt_redirect/rt_redir.h

    r1235 r1259  
    3939/* There are 2 locks in this module. The priority is established as follow to avoid deadlocks:
    4040exp_peer mutex > usages rwlock.
    41 (e.g., the rwlock can be taken while holding the mutex, but not the other way) 
     41(e.g., the rwlock can be taken while holding the mutex, but not the other way)
    4242*/
    4343
     
    5959/* Expiration time set for DONT_CACHE tasks, so that the entry is found when the code is called back */
    6060#define DEFAULT_EXPIRE_TIME 10 /* seconds */
    61        
     61
    6262/* Structure to store a parsed Redirect-Host */
    6363struct redir_host {
    64         struct fd_list chain; 
    65        
     64        struct fd_list chain;
     65
    6666        DiamId_t id;    /* malloc'd */
    6767        size_t   len;
    68         /* We don't use the following yet because we don't support dynamic new connections 
     68        /* We don't use the following yet because we don't support dynamic new connections
    6969        int      secure;
    7070        uint16_t port;
     
    117117        } user;
    118118};
    119        
     119
    120120
    121121/* Structure to store a Redirect indication */
    122122struct redir_entry {
    123123        uint32_t eyec; /* must be REDIR_ENTRY_EYEC, used for debug only */
    124        
     124
    125125        struct {
    126126                os0_t s; /* alloc'd, must be freed */
     
    132132        struct timespec  timeout;  /* When does this entry expires? */
    133133        struct fd_list   exp_list; /* chain in the expire_list list, ordered by expiration date, protected by exp_peer_lock */
    134        
     134
    135135        enum redir_h_u type;  /* Type of this entry */
    136136        struct fd_list redir_list; /* link in redirects_usages lists. Lists are ordered by the data value. Protected by rw locks */
Note: See TracChangeset for help on using the changeset viewer.