• zhiqiangxu's avatar
    p2p/discover: improve nodesByDistance.push code (#26019) · a9dfac03
    zhiqiangxu authored
    This improves readability of function 'push'.
    
    sort.Search(N, ...) will at most return N when no match, so ix should be compared
    with N. The previous version would compare ix with N+1 in case an additional item
    was appended. No bug resulted from this comparison, but it's not easy to understand
    why.
    Co-authored-by: 's avatarFelix Lange <fjl@twurst.com>
    a9dfac03
table.go 19 KB