From 9c872c37c55eb4d1f8d06920d344852e81cbcd77 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 4 Jan 2017 00:27:05 -0500 Subject: Changed bucket-splitting logic. --- src/Network/BitTorrent/DHT/Routing.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Network/BitTorrent/DHT/Routing.hs') diff --git a/src/Network/BitTorrent/DHT/Routing.hs b/src/Network/BitTorrent/DHT/Routing.hs index 81624b2a..ba1f6799 100644 --- a/src/Network/BitTorrent/DHT/Routing.hs +++ b/src/Network/BitTorrent/DHT/Routing.hs @@ -423,7 +423,7 @@ splitTip nid n i bucket | testIdBit nid i = (One zeros (Tip nid (pred n) ones)) | otherwise = (Zero (Tip nid (pred n) zeros) ones) where - (zeros, ones) = split i bucket + (ones, zeros) = split i bucket -- | Used in each query. -- @@ -442,7 +442,7 @@ insert info @ NodeInfo {..} = go (0 :: BitIx) go i (Tip nid n bucket) | n == 0 = Tip nid n <$> insertNode info bucket | otherwise = Tip nid n <$> insertNode info bucket - <|> go (succ i) (splitTip nid n i bucket) + <|> go i (splitTip nid n i bucket) {----------------------------------------------------------------------- -- Conversion -- cgit v1.2.3