Revision 14893aa5

View differences:

loop-mt.c
195 195
  pthread_join(distributing_thread, NULL);
196 196
}
197 197

  
198
void source_loop(const char *fname, struct nodeID *s1, int csize, int chunks, bool loop)
198
void source_loop(const char *fname, struct nodeID *s1, int csize, int chunks, bool loop, int buff_size)
199 199
{
200 200
  pthread_t generate_thread, receive_thread, gossiping_thread, distributing_thread;
201 201
  
......
208 208

  
209 209
//  sigInit(s);
210 210
  peers_init();
211
  if (source_init(fname, s, loop, fds, FDSSIZE) < 0) {
211
  if (source_init(fname, s, loop, fds, FDSSIZE, buff_size) < 0) {
212 212
    fprintf(stderr,"Cannot initialize source, exiting");
213 213
    return;
214 214
  }
loop.c
104 104
  }
105 105
}
106 106

  
107
void source_loop(const char *fname, struct nodeID *s, int csize, int chunks, bool loop)
107
void source_loop(const char *fname, struct nodeID *s, int csize, int chunks, bool loop, int buff_size)
108 108
{
109 109
  int done = 0;
110 110
  static uint8_t buff[BUFFSIZE];
......
117 117
  
118 118
  peers_init();
119 119

  
120
  if (source_init(fname, s, loop, fds, FDSSIZE) < 0) {
120
  if (source_init(fname, s, loop, fds, FDSSIZE, buff_size) < 0) {
121 121
    fprintf(stderr,"Cannot initialize source, exiting");
122 122
    return;
123 123
  }
loop.h
8 8
#define LOOP_H
9 9

  
10 10
void loop(struct nodeID *s, int period, int buff_size);
11
void source_loop(const char *fname, struct nodeID *s, int csize, int chunks, bool loop);
11
void source_loop(const char *fname, struct nodeID *s, int csize, int chunks, bool loop, int buff_size);
12 12

  
13 13
#endif	/* LOOP_H */
streamer.c
248 248

  
249 249
    loop(my_sock, 1000000 / chunks_per_second, buff_size);
250 250
  } else {
251
    source_loop(fname, my_sock, period * 1000, multiply, loop_input);
251
    source_loop(fname, my_sock, period * 1000, multiply, loop_input, buff_size);
252 252
  }
253 253
  return 0;
254 254
}
streaming.c
106 106
  init_measures();
107 107
}
108 108

  
109
int source_init(const char *fname, struct nodeID *myID, bool loop, int *fds, int fds_size)
109
int source_init(const char *fname, struct nodeID *myID, bool loop, int *fds, int fds_size, int buff_size)
110 110
{
111 111
  int flags = 0;
112 112

  
......
122 122
    return -1;
123 123
  }
124 124

  
125
  stream_init(1, myID);
125
  stream_init(buff_size, myID);
126 126
  return 0;
127 127
}
128 128

  
streaming.h
10 10
#include <stdbool.h>
11 11

  
12 12
void stream_init(int size, struct nodeID *myID);
13
int source_init(const char *fname, struct nodeID *myID, bool loop, int *fds, int fds_size);
13
int source_init(const char *fname, struct nodeID *myID, bool loop, int *fds, int fds_size, int buff_size);
14 14
void received_chunk(struct nodeID *from, const uint8_t *buff, int len);
15 15
void send_chunk();
16 16
struct chunk *generated_chunk(suseconds_t *delta);

Also available in: Unified diff