Revision eb29e340 som/TopologyManager/topocache.c

View differences:

som/TopologyManager/topocache.c
423 423

  
424 424
}
425 425
  
426

  
427

  
428
struct peer_cache *merge_caches_ranked(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source, ranking_function rank, void *mymetadata)
426
struct peer_cache *merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source)
429 427
{
430 428
  int n1, n2;
431 429
  struct peer_cache *new_cache;
......
465 463
      }
466 464
      n1++;
467 465
    } else {
468
      int nowFirst;
469

  
470
      nowFirst = 0;
471
      if (rank) {
472
        nowFirst = rank(mymetadata, c1->metadata + n1 * c1->metadata_size,
473
                        c2->metadata + n2 * c2->metadata_size);
474
      }
475
      if (nowFirst == 0) {
476
        nowFirst = c2->entries[n2].timestamp > c1->entries[n1].timestamp ? 1 : 2;
477
      }
478
      if (nowFirst == 1) {
466
      if (c2->entries[n2].timestamp > c1->entries[n1].timestamp) {
479 467
        if (in_cache(new_cache, &c1->entries[n1]) < 0) {
480 468
          if (new_cache->metadata_size) {
481 469
            memcpy(meta, c1->metadata + n1 * c1->metadata_size, c1->metadata_size);
......
503 491

  
504 492
  return new_cache;
505 493
}
506

  
507
struct peer_cache *merge_caches(struct peer_cache *c1, struct peer_cache *c2, int newsize, int *source)
508
{
509
  return merge_caches_ranked(c1, c2, newsize, source, NULL, NULL);
510
}

Also available in: Unified diff