17 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 |
*) |
*) |
19 |
|
|
20 |
(* |
(* |
21 |
Detect clients switching to another client_hash, already is use by |
Detect clients switching to another client_hash, already is use by |
22 |
someone else (almost certainly a theft). |
someone else (almost certainly a theft). |
23 |
*) |
*) |
99 |
by_hash := new_record; |
by_hash := new_record; |
100 |
true |
true |
101 |
| _, _, _ -> |
| _, _, _ -> |
102 |
(* it switched to a hash that's used somewhere else, |
(* it switched to a hash that's used somewhere else, |
103 |
that's certainly a theft. *) |
that's certainly a theft. *) |
104 |
if !verbose then |
if !verbose then |
105 |
lprintf "That hash was already used somewhere else, that's certainly a theft!\n"; |
lprintf "That hash was already used somewhere else, that's certainly a theft!\n"; |
125 |
let to_string v _ = |
let to_string v _ = |
126 |
let v = Marshal.to_string v [] in |
let v = Marshal.to_string v [] in |
127 |
(* The header depends on Ocaml version. Remove it. *) |
(* The header depends on Ocaml version. Remove it. *) |
128 |
let v = String.sub v (Marshal.header_size) |
let v = String.sub v (Marshal.header_size) |
129 |
(String.length v - Marshal.header_size) in |
(String.length v - Marshal.header_size) in |
130 |
v |
v |
131 |
|
|
132 |
end |
end |
133 |
|
|
134 |
(* test code *) |
(* test code *) |
135 |
(* |
(* |
162 |
lprintf "Third peer takes a hash that *was* first's hash, ok (?)...\n"; |
lprintf "Third peer takes a hash that *was* first's hash, ok (?)...\n"; |
163 |
assert(register_client_hash peer3 (Md4.of_string "11111111111111111111111111111111")); |
assert(register_client_hash peer3 (Md4.of_string "11111111111111111111111111111111")); |
164 |
dump (); |
dump (); |
165 |
|
|
166 |
exit 2 |
exit 2 |
167 |
|
|
168 |
let _ = |
let _ = |