From 29844b8b6c012c09f174fb0e50bb1d9a457c3908 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 12 Jul 2016 17:49:00 +1000 Subject: [PATCH] Few slices name changes --- torrent.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/torrent.go b/torrent.go index 6c4e8c2a..aa7247cb 100644 --- a/torrent.go +++ b/torrent.go @@ -441,7 +441,7 @@ func (t *Torrent) writeStatus(w io.Writer, cl *Client) { func() { tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0) fmt.Fprintf(tw, " URL\tNext announce\tLast announce\n") - for _, ta := range slices.Sort(slices.FromElems(t.trackerAnnouncers), func(l, r *trackerScraper) bool { + for _, ta := range slices.Sort(slices.FromMapElems(t.trackerAnnouncers), func(l, r *trackerScraper) bool { return l.url < r.url }).([]*trackerScraper) { fmt.Fprintf(tw, " %s\n", ta.statusLine()) @@ -749,7 +749,7 @@ func (t *Torrent) extentPieces(off, _len int64) (pieces []int) { // pieces, or has been in worser half of the established connections for more // than a minute. func (t *Torrent) worstBadConn() *connection { - wcs := slices.AsHeap(t.worstUnclosedConns(), worseConn) + wcs := slices.HeapInterface(t.worstUnclosedConns(), worseConn) for wcs.Len() != 0 { c := heap.Pop(wcs).(*connection) if c.UnwantedChunksReceived >= 6 && c.UnwantedChunksReceived > c.UsefulChunksReceived { @@ -1339,7 +1339,7 @@ func (t *Torrent) SetMaxEstablishedConns(max int) (oldMax int) { defer t.cl.mu.Unlock() oldMax = t.maxEstablishedConns t.maxEstablishedConns = max - wcs := slices.AsHeap(append([]*connection(nil), t.conns...), worseConn) + wcs := slices.HeapInterface(append([]*connection(nil), t.conns...), worseConn) for len(t.conns) > t.maxEstablishedConns && wcs.Len() > 0 { t.dropConnection(wcs.Pop().(*connection)) } -- 2.48.1