]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Few slices name changes
authorMatt Joiner <anacrolix@gmail.com>
Tue, 12 Jul 2016 07:49:00 +0000 (17:49 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 12 Jul 2016 07:49:00 +0000 (17:49 +1000)
torrent.go

index 6c4e8c2a8d3cdc36b92b376fb104e8540298afc7..aa7247cb368e051be54039f4be73ab36c1a425bb 100644 (file)
@@ -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))
        }