Revision 0a40460a
dumbstreamer.c | ||
---|---|---|
21 | 21 |
static const char *srv_ip = ""; |
22 | 22 |
static int period = 500; |
23 | 23 |
static int chunks_per_second = 4; |
24 |
static int buff_size = 8; |
|
24 | 25 |
|
25 | 26 |
static void cmdline_parse(int argc, char *argv[]) |
26 | 27 |
{ |
27 | 28 |
int o; |
28 | 29 |
|
29 |
while ((o = getopt(argc, argv, "p:i:P:I:")) != -1) { |
|
30 |
while ((o = getopt(argc, argv, "b:c:t:p:i:P:I:")) != -1) {
|
|
30 | 31 |
switch(o) { |
32 |
case 'b': |
|
33 |
buff_size = atoi(optarg); |
|
34 |
break; |
|
35 |
case 'c': |
|
36 |
chunks_per_second = atoi(optarg); |
|
37 |
break; |
|
38 |
case 't': |
|
39 |
period = atoi(optarg); |
|
40 |
break; |
|
31 | 41 |
case 'p': |
32 | 42 |
srv_port = atoi(optarg); |
33 | 43 |
break; |
... | ... | |
84 | 94 |
} |
85 | 95 |
topAddNeighbour(srv); |
86 | 96 |
|
87 |
loop(my_sock, 1000000 / chunks_per_second); |
|
97 |
loop(my_sock, 1000000 / chunks_per_second, buff_size);
|
|
88 | 98 |
} |
89 | 99 |
|
90 | 100 |
source_loop(my_sock, period * 1000, chunks_per_second * period / 1000); |
loop-mt.c | ||
---|---|---|
121 | 121 |
return NULL; |
122 | 122 |
} |
123 | 123 |
|
124 |
void loop(struct nodeID *s1, int csize) |
|
124 |
void loop(struct nodeID *s1, int csize, int buff_size)
|
|
125 | 125 |
{ |
126 | 126 |
pthread_t receive_thread, gossiping_thread, distributing_thread; |
127 | 127 |
|
128 | 128 |
period = csize; |
129 | 129 |
s = s1; |
130 | 130 |
|
131 |
stream_init(8, s); // FIXME!
|
|
131 |
stream_init(buff_size, s);
|
|
132 | 132 |
pthread_mutex_init(&cb_mutex, NULL); |
133 | 133 |
pthread_mutex_init(&topology_mutex, NULL); |
134 | 134 |
pthread_create(&receive_thread, NULL, receive, NULL); |
loop.c | ||
---|---|---|
47 | 47 |
return -1; |
48 | 48 |
} |
49 | 49 |
|
50 |
void loop(struct nodeID *s, int csize) |
|
50 |
void loop(struct nodeID *s, int csize, int buff_size)
|
|
51 | 51 |
{ |
52 | 52 |
int done = 0; |
53 | 53 |
#define BUFFSIZE 1024 |
... | ... | |
58 | 58 |
period.tv_usec = csize % 1000000; |
59 | 59 |
|
60 | 60 |
topParseData(NULL, 0); |
61 |
stream_init(8, s);
|
|
61 |
stream_init(buff_size, s);
|
|
62 | 62 |
while (!done) { |
63 | 63 |
int len; |
64 | 64 |
int fd; |
loop.h | ||
---|---|---|
1 |
void loop(struct nodeID *s, int period); |
|
1 |
void loop(struct nodeID *s, int period, int buff_size);
|
|
2 | 2 |
void source_loop(struct nodeID *s, int csize, int chunks); |
3 | 3 |
|
Also available in: Unified diff