summaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/thibaut/client.ml12
-rw-r--r--sources/thibaut/clientArg.ml2
-rw-r--r--sources/thibaut/clientGlobals.ml14
-rw-r--r--sources/thibaut/clientMessages.ml4
4 files changed, 18 insertions, 14 deletions
diff --git a/sources/thibaut/client.ml b/sources/thibaut/client.ml
index 78e6fed..5e76289 100644
--- a/sources/thibaut/client.ml
+++ b/sources/thibaut/client.ml
@@ -5,7 +5,7 @@ open ClientMessages
open Unix
let round = ref 0
-let reply_tick = 30.
+let reply_tick = 20.
let mesh_tick = 30.
let seed_tick = !accuracy/.2.
let log_tick = 60.
@@ -37,13 +37,15 @@ let init_round time =
hmap = UserMap.empty;
replies = Queue.create ()
} in
- rounds_data := RoundMap.add !round data !rounds_data;
- send_to_all (Seed(!round, data.seed, data.duration))
+ rounds_data := RoundMap.add !round data !rounds_data;
+ Printf.fprintf !protlog_ic "%.0f Round %d\n%!" time !round;
+ send_to_all (Seed(!round, data.seed, data.duration))
let init_pulse time =
let data = RoundMap.find !round !rounds_data in
- data.phase <- IDLE;
- send_to_all (Pulse(!round, data.seed, [data.hmap]))
+ data.phase <- IDLE;
+ Printf.fprintf !protlog_ic "%.0f Pulse %d\n%!" time !round;
+ send_to_all (Pulse(!round, data.seed, [data.hmap]))
let check_present = 60.
let keep_alive = 32.
diff --git a/sources/thibaut/clientArg.ml b/sources/thibaut/clientArg.ml
index 43fdb5f..7b2faa0 100644
--- a/sources/thibaut/clientArg.ml
+++ b/sources/thibaut/clientArg.ml
@@ -6,7 +6,7 @@ let server = ref false
let id_file = ref "id.conf"
let generate = ref false
let degree = ref 10
-let accuracy = ref 125.
+let accuracy = ref 300.
let logdir = ref "log"
let arg_list = Arg.align [
diff --git a/sources/thibaut/clientGlobals.ml b/sources/thibaut/clientGlobals.ml
index 72645d3..88437a1 100644
--- a/sources/thibaut/clientGlobals.ml
+++ b/sources/thibaut/clientGlobals.ml
@@ -117,7 +117,9 @@ let protlog_ic = ref (open_out_gen [Open_append; Open_creat] 0o644
let id_ic = safe_open open_in !id_file
let my_id = Scanf.fscanf id_ic "%d" (fun x -> x)
let conf_ic = safe_open open_in !config_file
-let root_addr, root_port = Scanf.fscanf conf_ic "%s\n%d" (fun a b -> a,b)
+let root_name, root_port = Scanf.fscanf conf_ic "%s\n%d" (fun a b -> a,b)
+let root_addr_list = (gethostbyname root_name).h_addr_list
+let root_addr = root_addr_list.(0)
let _ =
close_in conf_ic;
close_in id_ic
@@ -126,12 +128,12 @@ let my_addr = (gethostbyname(gethostname())).h_addr_list.(0)
let socketfd = socket PF_INET SOCK_DGRAM 0
let addr = ADDR_INET(
- my_addr,
+ inet_addr_any,
!port
)
let root_addr = ADDR_INET(
- inet_addr_of_string root_addr,
+ root_addr,
root_port
)
@@ -140,9 +142,9 @@ let _ =
bind socketfd addr
with
| Unix_error(e,s1,s2) ->
- Printf.eprintf "Could not bind socket on port %d: %s in %s %s\n%!"
- !port (error_message e) s1 s2;
- exit 1
+ Printf.eprintf "Could not bind socket on port %d: %s in %s %s\n%!"
+ !port (error_message e) s1 s2;
+ exit 1
let _ =
Printf.printf "Now listening on UDP %s\n%!" (string_of_sockaddr addr)
diff --git a/sources/thibaut/clientMessages.ml b/sources/thibaut/clientMessages.ml
index b4147c0..c41554a 100644
--- a/sources/thibaut/clientMessages.ml
+++ b/sources/thibaut/clientMessages.ml
@@ -176,8 +176,8 @@ let process_message time s addr =
let hash = UserMap.find my_id h in
let hmap = find_reply hash data.replies in
if verify_branch branch then begin
- Printf.fprintf !protlog_ic "%.0f Proof %d\n%!"
- time round;
+ Printf.fprintf !protlog_ic "%.0f Proof %d %d\n%!"
+ time round (List.length branch);
let branch2 = hmap::branch in
let message = Pulse(round,seed,branch2) in
if data.phase = SEEDING then begin