Revision 4aaa8891 streaming.c

View differences:

streaming.c
43 43
struct timeval what_time; //to store the epoch time
44 44
uint64_t time_now; //to evaluate system time in us precision
45 45
int hc; //variable for storing the hopcount
46
extern bool log_on;
46 47
//____________________________
47 48

  
48 49
struct chunk_buffer *cb;
......
261 262
    gettimeofday(&what_time, NULL);	
262 263
    time_now= what_time.tv_sec * 1000000ULL + what_time.tv_usec;
263 264
    hc = chunk_get_hopcount(&c);
264
    fprintf(stderr, "TEO: Received chunk %d from peer: %s at: %lld hopcount: %i\n", c.id, node_addr(from), time_now, hc);
265
    if(log_on){fprintf(stderr, "TEO: Received chunk %d from peer: %s at: %lld hopcount: %i\n", c.id, node_addr(from), time_now, hc);}
265 266
    //_________________________________________	    
266 267
    output_deliver(&c);
267 268
    res = cb_add_chunk(cb, &c);
268 269
    cb_print();
269 270
    if (res < 0) {
270 271
      dprintf("\tchunk too old, buffer full with newer chunks\n");
271
      fprintf(stderr, "TEO: Received chunk: %d too old (buffer full with newer chunks) from peer: %s at: %lld\n", c.id, node_addr(from), time_now); //ENST
272
      if(log_on){fprintf(stderr, "TEO: Received chunk: %d too old (buffer full with newer chunks) from peer: %s at: %lld\n", c.id, node_addr(from), time_now);} //ENST
272 273
      free(c.data);
273 274
      free(c.attributes);
274 275
    }
......
420 421
	//___________________ENST__________________________________
421 422
        gettimeofday(&what_time, NULL);	
422 423
        time_now = what_time.tv_sec * 1000000ULL + what_time.tv_usec;	
423
	fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %lld Result: %d\n", c->id, node_addr(to->id), time_now, res);
424
	if(log_on){fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %lld Result: %d\n", c->id, node_addr(to->id), time_now, res);}
424 425
	//________________________________________________________
425 426

  
426 427
      } else {
......
497 498
  int size, res, i, n;
498 499
  struct peer *neighbours;
499 500
  struct peerset *pset;
500

  
501
  //extern bool log_on;
502
	
501 503
  pset = get_peers();
502 504
  n = peerset_size(pset);
503 505
  neighbours = peerset_get_peers(pset);
......
534 536
      //______________ENST_______________________
535 537
      gettimeofday(&what_time, NULL);	 	 
536 538
      time_now = what_time.tv_sec * 1000000ULL + what_time.tv_usec;
539
      if(log_on){
537 540
      fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %lld ", c->id, node_addr(p->id), time_now);
541
      }
538 542
      //________________________________________
539 543

  
540 544
      chunk_attributes_update_sending(c);
541 545
      res = sendChunk(p->id, c);
542
      fprintf(stderr, "Result: %d Size: %d bytes\n", res, c->size); //ENST
546
      if(log_on){fprintf(stderr, "Result: %d Size: %d bytes\n", res, c->size);} //ENST
543 547
      dprintf("\tResult: %d\n", res);
544 548
      if (res>=0) {
545 549
        chunkID_set_add_chunk(p->bmap,c->id); //don't send twice ... assuming that it will actually arrive

Also available in: Unified diff