From 636320f9010be75c0ae804714ddce62b46f17930 Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Thu, 7 Jul 2022 12:29:50 -0400 Subject: [PATCH] p2p: delete cruft (#8958) I think the decision in #8806 is that we shouldn't do this yet, so I think it's best to just drop this. --- internal/p2p/peermanager.go | 41 ------------------------------------- 1 file changed, 41 deletions(-) diff --git a/internal/p2p/peermanager.go b/internal/p2p/peermanager.go index 8230b262e..fabff390e 100644 --- a/internal/p2p/peermanager.go +++ b/internal/p2p/peermanager.go @@ -1419,47 +1419,6 @@ func (s *peerStore) Ranked() []*peerInfo { } sort.Slice(s.ranked, func(i, j int) bool { return s.ranked[i].Score() > s.ranked[j].Score() - // TODO: reevaluate more wholistic sorting, perhaps as follows: - - // // sort inactive peers after active peers - // if s.ranked[i].Inactive && !s.ranked[j].Inactive { - // return false - // } else if !s.ranked[i].Inactive && s.ranked[j].Inactive { - // return true - // } - - // iLastDialed, iLastDialSuccess := s.ranked[i].LastDialed() - // jLastDialed, jLastDialSuccess := s.ranked[j].LastDialed() - - // // sort peers who our most recent dialing attempt was - // // successful ahead of peers with recent dialing - // // failures - // switch { - // case iLastDialSuccess && jLastDialSuccess: - // // if both peers were (are?) successfully - // // connected, convey their score, but give the - // // one we dialed successfully most recently a bonus - - // iScore := s.ranked[i].Score() - // jScore := s.ranked[j].Score() - // if jLastDialed.Before(iLastDialed) { - // jScore++ - // } else { - // iScore++ - // } - - // return iScore > jScore - // case iLastDialSuccess: - // return true - // case jLastDialSuccess: - // return false - // default: - // // if both peers were not successful in their - // // most recent dialing attempt, fall back to - // // peer score. - - // return s.ranked[i].Score() > s.ranked[j].Score() - // } }) return s.ranked }