From 34c8b02ffb322f60025ba88cc5ff8148a9238bcb Mon Sep 17 00:00:00 2001 From: ygrek Date: Tue, 25 Jan 2011 17:13:37 +0200 Subject: [PATCH] make token more robust against broken nodes --- src/networks/bittorrent/bT_DHT.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/networks/bittorrent/bT_DHT.ml b/src/networks/bittorrent/bT_DHT.ml index e322f8bc..8d6f039c 100644 --- a/src/networks/bittorrent/bT_DHT.ml +++ b/src/networks/bittorrent/bT_DHT.ml @@ -460,7 +460,8 @@ let valid t s = end -let make_token addr h secret = string_of_int (Hashtbl.hash [show_addr addr; H.direct_to_string h; secret]) +(* do not hash port cause some broken implementations change it all the time *) +let make_token (ip,_) h secret = string_of_int (Hashtbl.hash (Ip.to_string ip, H.direct_to_string h, secret)) let valid_token addr h secret token = let cur = Secret.get secret in -- 2.11.4.GIT