Revision 483dec26 topology.c

View differences:

topology.c
36 36
double alpha_target = 0.5;
37 37
double topo_mem = 0;
38 38

  
39
bool topo_out = true; //peer selects out-neighbours
40
bool topo_in = true; //peer selects in-neighbours (combined means bidirectional)
41

  
39 42
int NEIGHBORHOOD_TARGET_SIZE = 30;
40 43
double NEIGHBORHOOD_ROTATE_RATIO = 1.0;
41 44
#define TMAN_MAX_IDLE 10
......
275 278
  }
276 279

  
277 280
  //handle explicit add/remove messages
278
  if (buff && buff[0] == MSG_TYPE_STREAMER_TOPOLOGY) {
281
  if (topo_in && buff && buff[0] == MSG_TYPE_STREAMER_TOPOLOGY) {
279 282
    dtprintf(stderr,"Topo: explicit topo message received!!!from %s (peers:%d)\n", node_addr(from), peerset_size(pset));
280 283
    if (len != 2) {
281 284
      fprintf(stderr, "Bad streamer topo message received, len:%d!\n", len);
......
356 359
      //searching for the metadata
357 360
      if (nidset_find(&j, newids, newids_size, toadds[i])) {
358 361
        fprintf(stderr," adding %s\n", node_addr(toadds[i]));
359
        add_peer(newids[j], &metas[j], true, true);
362
        add_peer(newids[j], &metas[j], topo_out, topo_in);
360 363
      } else {
361 364
        fprintf(stderr," Error: missing metadata for %s\n", node_addr(toadds[i]));
362 365
      }
......
367 370
    nidset_complement(toremoves, &toremoves_size, oldids, oldids_size, selecteds, selecteds_size);
368 371
    for (i = 0; i < toremoves_size; i++) {
369 372
      fprintf(stderr," removing %s\n", node_addr(toremoves[i]));
370
      remove_peer(toremoves[i], true, true);
373
      remove_peer(toremoves[i], topo_out, topo_in);
371 374
    }
372 375
    fprintf(stderr,"Topo remove end\n");
373 376
  }
......
381 384
  if (!p) {
382 385
    //fprintf(stderr,"warning: received message from unknown peer: %s!%s\n",node_addr(id), reg ? " Adding it to pset." : "");
383 386
    if (reg) {
384
      add_peer(id,NULL, true, false);
387
      add_peer(id,NULL, topo_out, false);
385 388
      fprintf(stderr,"Topo: ext adding %s (peers:%d)\n", node_addr(id), peerset_size(pset));
386 389
      p = peerset_get_peer(pset,id);
387 390
    }

Also available in: Unified diff