Set link number
This commit is contained in:
parent
7dd57158c7
commit
a16fb465f8
11 changed files with 20 additions and 9 deletions
|
@ -3,7 +3,7 @@ mkdir -p ./log
|
|||
tor -f /etc/torrc > ./log/client-tor-stdout.log 2> ./log/client-tor-stderr.log &
|
||||
sleep 2
|
||||
mkdir -p ./shared
|
||||
donar -a rr -b -c -o ./shared/onion_services.pub -r 9000 -v > ./log/client-donar-stdout.log 2> ./log/client-donar-stderr.log &
|
||||
donar -a rr -b -l 8 -c -o ./shared/onion_services.pub -r 9000 -v > ./log/client-donar-stdout.log 2> ./log/client-donar-stderr.log &
|
||||
sleep 2
|
||||
measlat -h 127.13.3.7 -p 9000 > /dev/null 2>&1 # Used to wait for connections
|
||||
dump_circuits > ./log/circuits.txt
|
||||
|
|
|
@ -6,5 +6,5 @@ mkdir -p ./shared
|
|||
cd ./shared
|
||||
pwd
|
||||
( sleep 180; dump_circuits > ../log/server-circuits.txt ) &
|
||||
donar -a rr -b -s -e 9000 -v > ../log/server-donar-stdout.log 2> ../log/server-donar-stderr.log &
|
||||
donar -a rr -b -l 8 -s -e 9000 -v > ../log/server-donar-stdout.log 2> ../log/server-donar-stderr.log &
|
||||
udpecho -p 9000 -v > ../log/server-udpecho-stdout.log 2> ../log/server-udpecho-stderr.log
|
||||
|
|
|
@ -3,7 +3,7 @@ mkdir -p ./log
|
|||
tor -f /etc/torrc > ./log/client-tor-stdout.log 2> ./log/client-tor-stderr.log &
|
||||
sleep 2
|
||||
mkdir -p ./shared
|
||||
donar -a rr -b -h -c -o ./shared/onion_services.pub -r 9000 > ./log/client-donar-stdout.log 2> ./log/client-donar-stderr.log &
|
||||
donar -a rr -b -h -l 8 -c -o ./shared/onion_services.pub -r 9000 > ./log/client-donar-stdout.log 2> ./log/client-donar-stderr.log &
|
||||
sleep 2
|
||||
measlat -h 127.13.3.7 -p 9000 > /dev/null 2>&1 # Used to wait for connections
|
||||
dump_circuits > ./log/circuits.txt
|
||||
|
|
|
@ -6,5 +6,5 @@ mkdir -p ./shared
|
|||
cd ./shared
|
||||
pwd
|
||||
( sleep 180; dump_circuits > ../log/server-circuits.txt ) &
|
||||
donar -a rr -b -h -s -e 9000 > ../log/server-donar-stdout.log 2> ../log/server-donar-stderr.log &
|
||||
donar -a rr -l 8 -b -h -s -e 9000 > ../log/server-donar-stdout.log 2> ../log/server-donar-stderr.log &
|
||||
udpecho -p 9000 > ../log/server-udpecho-stdout.log 2> ../log/server-udpecho-stderr.log
|
||||
|
|
|
@ -54,7 +54,7 @@ int algo_dup2_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdin
|
|||
|
||||
struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write");
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int i = 0; i < app_ctx->ap.links; i++) {
|
||||
// 1. A whole packet has been read, we will find someone to write it
|
||||
to_fdinfo = cat->socklist->len > i ? g_array_index(cat->socklist, struct evt_core_fdinfo*, i) : NULL;
|
||||
if (to_fdinfo == NULL) {
|
||||
|
|
|
@ -239,7 +239,7 @@ int algo_rr_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo
|
|||
int max = 10;
|
||||
uint8_t sel_link = rr->current_link;
|
||||
while(max-- >= 0) {
|
||||
sel_link = (sel_link + 1) % 8;
|
||||
sel_link = (sel_link + 1) % app_ctx->ap.links;
|
||||
sprintf(url, "tcp:write:127.0.0.1:%d", 7500 + sel_link); //@FIXME Hardcoded
|
||||
to_fdinfo = evt_core_get_from_url (ctx, url);
|
||||
if (to_fdinfo == NULL) continue; // Missing link
|
||||
|
|
|
@ -10,6 +10,7 @@ struct algo_params {
|
|||
uint8_t is_waiting_bootstrap;
|
||||
uint8_t is_healing;
|
||||
char* algo_name;
|
||||
int links, fresh_data, redundant_data;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ int main(int argc, char** argv) {
|
|||
struct donar_params dp = {0};
|
||||
donar_init_params (&dp);
|
||||
|
||||
while ((dp.opt = getopt(argc, argv, "vcse:r:o:a:bh")) != -1) {
|
||||
while ((dp.opt = getopt(argc, argv, "vcse:r:o:a:bhl:")) != -1) {
|
||||
switch(dp.opt) {
|
||||
case 'v':
|
||||
dp.verbose++;
|
||||
|
@ -47,6 +47,12 @@ int main(int argc, char** argv) {
|
|||
case 'b':
|
||||
dp.is_waiting_bootstrap = 1;
|
||||
break;
|
||||
case 'l':
|
||||
dp.links = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
sscanf(optarg, "%d,%d", &dp.fresh_data, &dp.redundant_data);
|
||||
break;
|
||||
default:
|
||||
goto in_error;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,10 @@ void donar_client(struct donar_client_ctx* ctx, struct donar_params* dp) {
|
|||
struct algo_params ap = {
|
||||
.is_waiting_bootstrap = dp->is_waiting_bootstrap,
|
||||
.is_healing = dp->is_healing,
|
||||
.algo_name = dp->algo
|
||||
.algo_name = dp->algo,
|
||||
.links = dp->links,
|
||||
.fresh_data = dp->fresh_data,
|
||||
.redundant_data = dp->redundant_data
|
||||
};
|
||||
|
||||
evt_core_init (&(ctx->evts), dp->verbose);
|
||||
|
|
|
@ -151,6 +151,7 @@ void donar_init_params(struct donar_params* dp) {
|
|||
dp->is_healing = 0;
|
||||
dp->is_waiting_bootstrap = 0;
|
||||
dp->errored = 0;
|
||||
dp->links = 2;
|
||||
dp->remote_ports = g_ptr_array_new_with_free_func (free_port);
|
||||
dp->exposed_ports = g_ptr_array_new_with_free_func (free_port);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "packet.h"
|
||||
|
||||
struct donar_params {
|
||||
int opt, is_server, is_client, is_waiting_bootstrap, is_healing, errored, verbose;
|
||||
int opt, is_server, is_client, is_waiting_bootstrap, is_healing, errored, verbose, links, fresh_data, redundant_data;
|
||||
char *port, *onion_file, *algo;
|
||||
GPtrArray *remote_ports, *exposed_ports;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue