Changeset 1273:e831cabceab0 in freeDiameter for extensions/rt_load_balance
- Timestamp:
- May 23, 2014, 11:08:04 PM (10 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rt_load_balance/rt_load_balance.c
r1270 r1273 3 3 * Author: Thomas Klausner <tk@giga.or.at> * 4 4 * * 5 * Copyright (c) 2013, Thomas Klausner*5 * Copyright (c) 2013, 2014 Thomas Klausner * 6 6 * All rights reserved. * 7 7 * * … … 59 59 CHECK_FCT(fd_peer_get_load_pending(peer, &to_receive, &to_send)); 60 60 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; 66 72 TRACE_DEBUG(FULL, "evaluated peer `%.*s', score was %d, now %d", (int)cand->diamidlen, cand->diamid, score, cand->score); 67 73 }
Note: See TracChangeset
for help on using the changeset viewer.