Revision 74a5d4ae topology.c

View differences:

topology.c
9 9
#include <sys/time.h>
10 10
#include <time.h>
11 11

  
12

  
12
#include <net_helper.h>
13 13
#include <peerset.h>
14 14
#include <peer.h>
15 15
#include <topmanager.h>
16 16

  
17
#include <net_helper.h>
18 17
#include "topology.h"
19 18
#include "streaming.h"
20 19
#include "dbg.h"
......
44 43
}
45 44

  
46 45
// currently it just makes the peerset grow
47
void update_peers(const struct nodeID *from, const uint8_t *buff, int len)
46
void update_peers(struct nodeID *from, const uint8_t *buff, int len)
48 47
{
49 48
  int n_ids, i;
50
  const struct nodeID * const *ids;
49
  const struct nodeID **ids;
51 50
  struct peer *peers;
52 51
  struct timeval tnow, told;
53 52

  
......
57 56
    if (peerset_check(pset, from) < 0) {
58 57
      topAddNeighbour(from, NULL, 0);	//@TODO: this is agressive
59 58
      if (!NEIGHBORHOOD_TARGET_SIZE || peerset_size(pset) < NEIGHBORHOOD_TARGET_SIZE) {
60
        add_peer((struct nodeID *)from);
59
        add_peer(from);
61 60
      }
62 61
    }
63 62
  }
......
68 67
  for(i = 0; i < n_ids; i++) {
69 68
    if(peerset_check(pset, ids[i]) < 0) {
70 69
      if (!NEIGHBORHOOD_TARGET_SIZE || peerset_size(pset) < NEIGHBORHOOD_TARGET_SIZE) {
71
        add_peer((struct nodeID *)ids[i]);
70
        add_peer(ids[i]);
72 71
      }
73 72
    }
74 73
  }
......
82 81
         ( timerisset(&peers[i].bmap_timestamp) && timercmp(&peers[i].bmap_timestamp, &told, <)     )   ) {
83 82
      //if (peerset_size(pset) > 1) {	// avoid dropping our last link to the world
84 83
        topRemoveNeighbour(peers[i].id);
85
        remove_peer((struct nodeID *)(peers[i--].id));
84
        remove_peer(peers[i--].id);
86 85
      //}
87 86
    }
88 87
  }
......
99 98
    fprintf(stderr,"warning: received message from unknown peer: %s!\n",node_addr(id));
100 99
    if (reg) {
101 100
      topAddNeighbour(id, NULL, 0);	//@TODO: this is agressive
102
      add_peer((struct nodeID *)id);
101
      add_peer(id);
103 102
      p = peerset_get_peer(pset,id);
104 103
    }
105 104
  }

Also available in: Unified diff