Revision 84ff82ba streaming.c

View differences:

streaming.c
11 11
#include <stdbool.h>
12 12
#include <math.h>
13 13
#include <assert.h>
14
#include <inttypes.h>
14 15

  
15 16
#include <net_helper.h>
16 17
#include <chunk.h> 
......
133 134
  struct chunk_attributes * ca;
134 135

  
135 136
  if (!c->attributes || c->attributes_size != sizeof(struct chunk_attributes)) {
136
    fprintf(stderr,"Warning, chunk %d with strange attributes block. Size:%d expected:%d\n", c->id, c->attributes ? c->attributes_size : 0, sizeof(struct chunk_attributes));
137
    fprintf(stderr,"Warning, chunk %d with strange attributes block. Size:%d expected:%lu\n", c->id, c->attributes ? c->attributes_size : 0, sizeof(struct chunk_attributes));
137 138
    return -1;
138 139
  }
139 140

  
......
146 147
  struct chunk_attributes * ca;
147 148

  
148 149
  if (!c->attributes || c->attributes_size != sizeof(struct chunk_attributes)) {
149
    fprintf(stderr,"Warning, received chunk %d with strange attributes block. Size:%d expected:%d\n", c->id, c->attributes ? c->attributes_size : 0, sizeof(struct chunk_attributes));
150
    fprintf(stderr,"Warning, received chunk %d with strange attributes block. Size:%d expected:%lu\n", c->id, c->attributes ? c->attributes_size : 0, sizeof(struct chunk_attributes));
150 151
    return;
151 152
  }
152 153

  
......
285 286
    reg_chunk_receive(c.id, c.timestamp, chunk_get_hopcount(&c));
286 287
    chunk_unlock(c.id);
287 288
    dprintf("Received chunk %d from peer: %s\n", c.id, node_addr(from));
288
    if(chunk_log){fprintf(stderr, "TEO: Received chunk %d from peer: %s at: %lld hopcount: %i\n", c.id, node_addr(from), gettimeofday_in_us(), chunk_get_hopcount(&c));}
289
    if(chunk_log){fprintf(stderr, "TEO: Received chunk %d from peer: %s at: %"PRIu64" hopcount: %i\n", c.id, node_addr(from), gettimeofday_in_us(), chunk_get_hopcount(&c));}
289 290
    output_deliver(&c);
290 291
    res = cb_add_chunk(cb, &c);
291 292
    cb_print();
292 293
    if (res < 0) {
293 294
      dprintf("\tchunk too old, buffer full with newer chunks\n");
294
      if(chunk_log){fprintf(stderr, "TEO: Received chunk: %d too old (buffer full with newer chunks) from peer: %s at: %lld\n", c.id, node_addr(from), gettimeofday_in_us());}
295
      if(chunk_log){fprintf(stderr, "TEO: Received chunk: %d too old (buffer full with newer chunks) from peer: %s at: %"PRIu64"\n", c.id, node_addr(from), gettimeofday_in_us());}
295 296
      free(c.data);
296 297
      free(c.attributes);
297 298
    }
......
447 448
        chunkID_set_add_chunk(to->bmap, c->id); //don't send twice ... assuming that it will actually arrive
448 449
        d++;
449 450
        reg_chunk_send(c->id);
450
        if(chunk_log){fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %lld Result: %d\n", c->id, node_addr(to->id), gettimeofday_in_us(), res);}
451
        if(chunk_log){fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %"PRIu64" Result: %d\n", c->id, node_addr(to->id), gettimeofday_in_us(), res);}
451 452
      } else {
452 453
        fprintf(stderr,"ERROR sending chunk %d\n",c->id);
453 454
      }
......
562 563

  
563 564
      chunk_attributes_update_sending(c);
564 565
      res = sendChunk(p->id, c);
565
      if(chunk_log){fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %lld Result: %d Size: %d bytes\n", c->id, node_addr(p->id), gettimeofday_in_us(), res, c->size);}
566
      if(chunk_log){fprintf(stderr, "TEO: Sending chunk %d to peer: %s at: %"PRIu64" Result: %d Size: %d bytes\n", c->id, node_addr(p->id), gettimeofday_in_us(), res, c->size);}
566 567
      dprintf("\tResult: %d\n", res);
567 568
      if (res>=0) {
568 569
        chunkID_set_add_chunk(p->bmap,c->id); //don't send twice ... assuming that it will actually arrive

Also available in: Unified diff