Revision 01873987 som/TopologyManager/ncast.c
som/TopologyManager/ncast.c | ||
---|---|---|
58 | 58 |
if (local_cache == NULL) { |
59 | 59 |
return -1; |
60 | 60 |
} |
61 |
ncast_proto_init(myID, metadata, metadata_size);
|
|
61 |
topo_proto_init(myID, metadata, metadata_size);
|
|
62 | 62 |
currtime = gettime(); |
63 | 63 |
bootstrap = true; |
64 | 64 |
|
... | ... | |
67 | 67 |
|
68 | 68 |
int topChangeMetadata(struct nodeID *peer, void *metadata, int metadata_size) |
69 | 69 |
{ |
70 |
if (ncast_proto_metadata_update(peer, metadata, metadata_size) <= 0) {
|
|
70 |
if (topo_proto_metadata_update(peer, metadata, metadata_size) <= 0) {
|
|
71 | 71 |
return -1; |
72 | 72 |
} |
73 | 73 |
|
... | ... | |
79 | 79 |
if (cache_add(local_cache, neighbour, metadata, metadata_size) < 0) { |
80 | 80 |
return -1; |
81 | 81 |
} |
82 |
return ncast_query_peer(local_cache, neighbour);
|
|
82 |
return topo_query_peer(local_cache, neighbour);
|
|
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
int topParseData(const uint8_t *buff, int len) |
86 | 86 |
{ |
87 | 87 |
if (len) { |
88 |
const struct ncast_header *h = (const struct ncast_header *)buff;
|
|
88 |
const struct topo_header *h = (const struct topo_header *)buff;
|
|
89 | 89 |
struct peer_cache *new, *remote_cache; |
90 | 90 |
|
91 | 91 |
if (h->protocol != MSG_TYPE_TOPOLOGY) { |
... | ... | |
97 | 97 |
bootstrap = false; |
98 | 98 |
|
99 | 99 |
if (h->type == NCAST_QUERY) { |
100 |
ncast_reply(buff + sizeof(struct ncast_header), len - sizeof(struct ncast_header), local_cache);
|
|
100 |
topo_reply(buff + sizeof(struct topo_header), len - sizeof(struct topo_header), local_cache);
|
|
101 | 101 |
} |
102 |
remote_cache = entries_undump(buff + sizeof(struct ncast_header), len - sizeof(struct ncast_header));
|
|
102 |
remote_cache = entries_undump(buff + sizeof(struct topo_header), len - sizeof(struct topo_header));
|
|
103 | 103 |
new = merge_caches(local_cache, remote_cache, cache_size); |
104 | 104 |
cache_free(remote_cache); |
105 | 105 |
if (new != NULL) { |
... | ... | |
110 | 110 |
|
111 | 111 |
if (time_to_send()) { |
112 | 112 |
cache_update(local_cache); |
113 |
ncast_query(local_cache);
|
|
113 |
topo_query(local_cache);
|
|
114 | 114 |
} |
115 | 115 |
|
116 | 116 |
return 0; |
Also available in: Unified diff