Revision fb76785c som/PeerSet/peerset_ops.c

View differences:

som/PeerSet/peerset_ops.c
4 4
#include "peerset_private.h"
5 5
#include "peer.h"
6 6
#include "peerset.h"
7
#include "chunkidset.h"
7 8
#include "net_helper.h"
8 9

  
9 10
#define DEFAULT_SIZE_INCREMENT 32
......
31 32

  
32 33
int peerset_add_peer(struct peerset *h, const struct nodeID *id)
33 34
{
35
  struct peer *e;
34 36
  if (peerset_check(h, id) >= 0) {
35 37
    return 0;
36 38
  }
......
45 47
    h->size += DEFAULT_SIZE_INCREMENT;
46 48
    h->elements = (struct peer*) res;
47 49
  }
48
  h->elements[h->n_elements++].id = id;
50
  e = &(h->elements[h->n_elements++]);
51
  e->id = nodeid_dup(id);
52
  e->bmap = chunkID_set_init(0);
49 53

  
50 54
  return h->n_elements;
51 55
}

Also available in: Unified diff