Revision 10ddaca7 src/PeerSampler/ncast.c

View differences:

src/PeerSampler/ncast.c
278 278
  return cache_del(context->local_cache, neighbour);
279 279
}
280 280

  
281
void ncast_destroy(struct peersampler_context **context)
282
{
283
	if (context && *context)
284
	{
285
		if((*context)->r)
286
			free((*context)->r);
287
		if((*context)->local_cache)
288
			cache_free((*context)->local_cache);
289
		if((*context)->tc)
290
			ncast_proto_destroy(&((*context)->tc));
291
		if((*context)->bootstrap_node)
292
			nodeid_free(((*context)->bootstrap_node));
293
		free(*context);
294
		*context = NULL;
295
	}
296
}
297

  
281 298
struct peersampler_iface ncast = {
282 299
  .init = ncast_init,
300
  .destroy = ncast_destroy,
283 301
  .change_metadata = ncast_change_metadata,
284 302
  .add_neighbour = ncast_add_neighbour,
285 303
  .parse_data = ncast_parse_data,
......
292 310

  
293 311
struct peersampler_iface ncastplus = {
294 312
  .init = ncastplus_init,
313
  .destroy = ncast_destroy,
295 314
  .change_metadata = ncast_change_metadata,
296 315
  .add_neighbour = ncast_add_neighbour,
297 316
  .parse_data = ncast_parse_data,

Also available in: Unified diff