• Jeromy's avatar
    Fix dht queries · badc7388
    Jeromy authored
    Queries previously would sometimes only query three (alpha value) peers
    before halting the operation. This PR changes the number of peers
    grabbed from the routing table to start a query to K.
    
    Dht nodes would also not respond with enough peers, as per the kademlia
    paper, this has been changed to from 4 to 'K'.
    
    The query mechanism itself also was flawed in that it would pull all the
    peers it had yet to query out of the queue and 'start' the query for
    them. The concurrency rate limiting was done inside the 'queryPeer'
    method after the goroutine was spawned. This did not allow for peers
    receiver from query replies to be properly queried in order of distance.
    
    License: MIT
    Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
    badc7388
query.go 7.24 KB