Navigation


Changeset 1273:e831cabceab0 in freeDiameter for extensions


Ignore:
Timestamp:
May 23, 2014, 11:08:04 PM (10 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

Switch to logarithmic scaling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_load_balance/rt_load_balance.c

    r1270 r1273  
    33* Author: Thomas Klausner <tk@giga.or.at>                                                                *
    44*                                                                                                        *
    5 * Copyright (c) 2013, Thomas Klausner                                                                    *
     5* Copyright (c) 2013, 2014 Thomas Klausner                                                               *
    66* All rights reserved.                                                                                   *
    77*                                                                                                        *
     
    5959                CHECK_FCT(fd_peer_get_load_pending(peer, &to_receive, &to_send));
    6060                load = to_receive + to_send;
    61                 score = cand->score;
    62                 if ((cand->score > 0) && (load >= cand->score))
    63                         cand->score = 1;
    64                 else
    65                         cand->score -= load;
     61                /* other routing mechanisms need to add to the
     62                 * appropriate entries so their base value is high
     63                 * enough that they are considered */
     64
     65                /* logarithmic scaling */
     66                int load_log = 0;
     67                while (load > 0) {
     68                    load_log++;
     69                    load /= 2;
     70                }
     71                cand->score -= load_log;
    6672                TRACE_DEBUG(FULL, "evaluated peer `%.*s', score was %d, now %d", (int)cand->diamidlen, cand->diamid, score, cand->score);
    6773        }
Note: See TracChangeset for help on using the changeset viewer.