Revision a1333f46

View differences:

som/TopologyManager/ncast.c
17 17
#include "topocache.h"
18 18
#include "topo_proto.h"
19 19
#include "proto.h"
20
#include "config.h"
20 21
#include "msg_types.h"
21 22

  
22
#define MAX_PEERS 10
23
#define DEFAULT_CACHE_SIZE 10
23 24

  
24 25
static uint64_t currtime;
25
static int cache_size = MAX_PEERS;
26
static int cache_size;
26 27
static struct peer_cache *local_cache;
27 28
static bool bootstrap = true;
28 29
static int bootstrap_period = 2000000;
......
54 55
 */
55 56
int topInit(struct nodeID *myID, void *metadata, int metadata_size, const char *config)
56 57
{
58
  struct tag *cfg_tags;
59
  int res;
60

  
61
  cfg_tags = config_parse(config);
62
  res = config_value_int(cfg_tags, "cache_size", &cache_size);
63
  if (!res) {
64
    cache_size = DEFAULT_CACHE_SIZE;
65
  }
66
  free(cfg_tags);
67
  
57 68
  local_cache = cache_init(cache_size, metadata_size);
58 69
  if (local_cache == NULL) {
59 70
    return -1;

Also available in: Unified diff