Navigation


Changeset 743:5d529eb0ad33 in freeDiameter


Ignore:
Timestamp:
Mar 29, 2011, 11:42:53 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Tags:
1.1.0
Message:

Fix bug in peers order

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/peers.c

    r740 r743  
    150150                                                next->p_hdr.info.pi_diamid, next->p_hdr.info.pi_diamidlen,
    151151                                                &cont );
    152                 if (cmp < 0)
    153                         li_inf = li;
     152                if (cmp > 0)
     153                        li_inf = li; /* it will come after this element, for sure */
    154154               
    155155                if (cmp == 0) {
    156                         ret = EEXIST;
     156                        ret = EEXIST; /* we have a duplicate */
    157157                        break;
    158158                }
     
    191191        /* Search in the list */
    192192        CHECK_POSIX( pthread_rwlock_rdlock(&fd_g_peers_rw) );
    193         if (igncase)
     193        if (igncase) {
    194194                for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
    195195                        struct fd_peer * next = (struct fd_peer *)li;
     
    203203                                break;
    204204                }
    205         else
     205        } else {
    206206                for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
    207207                        struct fd_peer * next = (struct fd_peer *)li;
     
    213213                        break;
    214214                }
     215        }
    215216        CHECK_POSIX( pthread_rwlock_unlock(&fd_g_peers_rw) );
    216217       
  • libfdproto/ostr.c

    r740 r743  
    7070
    7171/* less sensitive to case, slower. */
     72/* the semantics of "maybefurther" assume you are searching for os1 in a list of elements ordered, each element passed as os2 */
    7273int fd_os_almostcasesrch_int(uint8_t * os1, size_t os1sz, uint8_t * os2, size_t os2sz, int *maybefurther)
    7374{
Note: See TracChangeset for help on using the changeset viewer.