hxing
[oweals/gnunet.git] / src / core / gnunet-service-core_extern.c
1 /* code that should be moved outside of core/ entirely */
2
3 /**
4  * Merge the given performance data with the data we currently
5  * track for the given neighbour.
6  *
7  * @param n neighbour
8  * @param ats new performance data
9  * @param ats_count number of records in ats
10  */
11 static void
12 update_neighbour_performance (struct Neighbour *n,
13                               const struct GNUNET_TRANSPORT_ATS_Information
14                               *ats, uint32_t ats_count)
15 {
16   uint32_t i;
17   unsigned int j;
18
19   if (ats_count == 0)
20     return;
21   for (i = 0; i < ats_count; i++)
22   {
23     for (j = 0; j < n->ats_count; j++)
24     {
25       if (n->ats[j].type == ats[i].type)
26       {
27         n->ats[j].value = ats[i].value;
28         break;
29       }
30     }
31     if (j == n->ats_count)
32     {
33       GNUNET_array_append (n->ats, n->ats_count, ats[i]);
34     }
35   }
36 }
37
38
39