Revision 4aaa8891

View differences:

output.c
146 146
    if (buff[c->id % buff_size].data) {
147 147
      if (buff[c->id % buff_size].id == c->id) {
148 148
        /* Duplicate of a stored chunk */
149
	fprintf(stderr,"Duplicate! chunkID: %d\n", c->id); // ENST
149
	extern bool log_on; //ENST
150
	if(log_on){fprintf(stderr,"Duplicate! chunkID: %d\n", c->id);} // ENST
150 151
        dprintf("\tDuplicate!\n");
151 152
        reg_chunk_duplicate();
152 153
        return;
streamer.c
39 39
static const char *output_config;
40 40
static bool loop_input = false;
41 41
unsigned char msgTypes[] = {MSG_TYPE_TOPOLOGY,MSG_TYPE_CHUNK,MSG_TYPE_SIGNALLING};
42
bool log_on = false;
42 43

  
43 44
static void print_usage()
44 45
{
......
69 70
    "\t[-m chunks]: set the number of copies the source injects in the overlay.\n"
70 71
    "\t[-f filename]: name of the video stream file to transmit.\n"
71 72
    "\t[-F config]: configure the output module\n"
72
    "\t[-l]: loop the video stream.\n"
73
    "\t[--chunk_log]: print log on stderr\n"    
74
    "\t[-l]: loop the video getopt_long instead of getoptstream.\n"
73 75
    "\n"
74 76
    "NOTE: the peer will dump the received video on STDOUT in raw format\n"
75 77
    "      it can be played by your favourite player simply using a pipe\n"
......
95 97
{
96 98
  int o;
97 99

  
98
  while ((o = getopt(argc, argv, "b:o:c:t:p:i:P:I:f:F:m:lC:N:")) != -1) {
100
  int option_index = 0;
101
  static struct option long_options[] = {
102
         {"chunk_log", 0, 0, 0},
103
  };
104

  
105
    while ((o = getopt_long (argc, argv, "b:o:c:t:p:i:P:I:f:F:m:lC:N:",long_options, &option_index)) != -1) { //use this function to manage long option
106
 // while ((o = getopt(argc, argv, "b:o:c:t:p:i:P:I:f:F:m:lC:N:")) != -1) {
99 107
    switch(o) {
108
      case 0: //for long options
109
        log_on = true;
110
        break;
100 111
      case 'b':
101 112
        buff_size = atoi(optarg);
102 113
        break;
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