Revision 6c4b3276 src/Cache/topo_proto.c
src/Cache/topo_proto.c | ||
---|---|---|
109 | 109 |
return topo_query_peer_header(context, local_cache, dst, protocol, type, NULL, 0, max_peers); |
110 | 110 |
} |
111 | 111 |
|
112 |
int topo_proto_metadata_update(struct topo_context *context, const void *meta, int meta_size)
|
|
112 |
int topo_proto_myentry_update(struct topo_context *context, struct nodeID *s, int dts, const void *meta, int meta_size)
|
|
113 | 113 |
{ |
114 |
if (cache_metadata_update(context->myEntry, nodeid(context->myEntry, 0), meta, meta_size) > 0) { |
|
115 |
return 1; |
|
114 |
int ret = 1; |
|
115 |
|
|
116 |
if (s && !nodeid_equal(nodeid(context->myEntry, 0), s)) { |
|
117 |
fprintf(stderr, "ERROR: myEntry change not implemented!\n"); //TODO |
|
118 |
exit(1); |
|
119 |
} |
|
120 |
|
|
121 |
if (dts) { |
|
122 |
cache_delay(context->myEntry, dts); |
|
116 | 123 |
} |
117 | 124 |
|
118 |
return -1; |
|
125 |
if (meta) { |
|
126 |
if (cache_metadata_update(context->myEntry, nodeid(context->myEntry, 0), meta, meta_size) <= 0) { |
|
127 |
ret = -1; |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
return ret; |
|
132 |
} |
|
133 |
|
|
134 |
int topo_proto_metadata_update(struct topo_context *context, const void *meta, int meta_size) |
|
135 |
{ |
|
136 |
return topo_proto_myentry_update(context, nodeid(context->myEntry, 0), 0 , meta, meta_size); |
|
119 | 137 |
} |
120 | 138 |
|
121 | 139 |
struct topo_context* topo_proto_init(struct nodeID *s, const void *meta, int meta_size) |
Also available in: Unified diff