Navigation



Ignore:
Timestamp:
Mar 2, 2011, 6:21:59 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fix broken 'almostcasecmp' logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_redirect/redir_out.c

    r717 r738  
    171171                /* Special case: ALL_HOST rules: we decrease the score of the Origin-Host if present */
    172172                if (e->type == ALL_HOST) {
    173                         cmp = fd_os_almostcasecmp(cand->diamid, cand->diamidlen, e->data.host.s, e->data.host.l);
     173                        cmp = fd_os_almostcasesrch(cand->diamid, cand->diamidlen, e->data.host.s, e->data.host.l, NULL);
    174174                        if (!cmp) {
    175175                                TRACE_DEBUG(FULL, "Redirect msg %p: peer '%.*s' += %d (previous ALL_HOST Redirect originated from this peer)", msg, cand->diamidlen, cand->diamid, FD_SCORE_SENT_REDIRECT);
     
    198198                struct rtd_candidate * cand = (struct rtd_candidate *) lic;
    199199               
    200                 /* Is this candidate in the "Redirect-Host" list ? */
     200                /* 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;
    203                        
    204                         cmp = fd_os_cmp( cand->diamid, cand->diamidlen, host->id, host->len );
    205                        
    206                         if (cmp < 0)
    207                                 break; /* targets are ordered */
     203                        int cont;
     204                       
     205                        cmp = fd_os_almostcasesrch( cand->diamid, cand->diamidlen, host->id, host->len, &cont );
    208206                       
    209207                        if (cmp == 0) {
    210208                                TRACE_DEBUG(FULL, "Redirect msg %p: peer '%.*s' += %d (rule t:%d @%p)", msg, cand->diamidlen, cand->diamid, redirects_usages[e->type].score, e->type, e);
    211209                                cand->score += redirects_usages[e->type].score;
    212                         }
     210                                break;
     211                        }
     212                        if (!cont)
     213                                break;
    213214                }
    214215        }
Note: See TracChangeset for help on using the changeset viewer.