[PATCH 2/2] make token more robust against broken nodes
ygrek <[email protected]> Sun, 6 Mar 2011 12:11:38 +0200
| Newsgroups | gmane.network.mldonkey.user |
|---|---|
| Message-ID | <[email protected]> |
--- src/networks/bittorrent/bT_DHT.ml | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git src/networks/bittorrent/bT_DHT.ml src/networks/bittorrent/bT_DHT.ml index e322f8b..8d6f039 100644 --- src/networks/bittorrent/bT_DHT.ml +++ 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 -- 1.7.2.3