Search in sources :

Example 81 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class Show method printTorrentDetails.

/**
 * prints out the full details of a particular torrent
 * @param out
 * @param dm
 * @param torrentNum
 */
private static void printTorrentDetails(PrintStream out, DownloadManager dm, int torrentNum, List<String> args) {
    String name = dm.getDisplayName();
    if (name == null)
        name = "?";
    out.println("> -----");
    out.println("Info on Torrent #" + torrentNum + " (" + name + ")");
    out.println("- General Info -");
    String[] health = { "- no info -", "stopped", "no remote connections", "no tracker", "OK", "ko" };
    try {
        out.println("Health: " + health[dm.getHealthStatus()]);
    } catch (Exception e) {
        out.println("Health: " + health[0]);
    }
    out.println("State: " + Integer.toString(dm.getState()));
    if (dm.getState() == DownloadManager.STATE_ERROR)
        out.println("Error: " + dm.getErrorDetails());
    out.println("Hash: " + TorrentUtils.nicePrintTorrentHash(dm.getTorrent(), true));
    out.println("- Torrent file -");
    out.println("Torrent Filename: " + dm.getTorrentFileName());
    out.println("Saving to: " + dm.getSaveLocation());
    out.println("Created By: " + dm.getTorrentCreatedBy());
    out.println("Comment: " + dm.getTorrentComment());
    Category cat = dm.getDownloadState().getCategory();
    if (cat != null) {
        out.println("Category: " + cat.getName());
    }
    List<Tag> tags = TagManagerFactory.getTagManager().getTagsForTaggable(TagType.TT_DOWNLOAD_MANUAL, dm);
    String tags_str;
    if (tags.size() == 0) {
        tags_str = "None";
    } else {
        tags_str = "";
        for (Tag t : tags) {
            tags_str += (tags_str.length() == 0 ? "" : ",") + t.getTagName(true);
        }
    }
    out.println("Tags: " + tags_str);
    out.println("- Tracker Info -");
    TRTrackerAnnouncer trackerclient = dm.getTrackerClient();
    if (trackerclient != null) {
        out.println("URL: " + trackerclient.getTrackerURL());
        String timestr;
        try {
            int time = trackerclient.getTimeUntilNextUpdate();
            if (time < 0) {
                timestr = MessageText.getString("GeneralView.label.updatein.querying");
            } else {
                int minutes = time / 60;
                int seconds = time % 60;
                String strSeconds = "" + seconds;
                if (seconds < 10) {
                    // $NON-NLS-1$
                    strSeconds = "0" + seconds;
                }
                timestr = minutes + ":" + strSeconds;
            }
        } catch (Exception e) {
            timestr = "unknown";
        }
        out.println("Time till next Update: " + timestr);
        out.println("Status: " + trackerclient.getStatusString());
    } else
        out.println("  Not available");
    out.println("- Files Info -");
    DiskManagerFileInfo[] files = dm.getDiskManagerFileInfo();
    if (files != null) {
        for (int i = 0; i < files.length; i++) {
            out.print(((i < 9) ? "   " : "  ") + Integer.toString(i + 1) + " (");
            String tmp = ">";
            if (files[i].getPriority() > 0)
                tmp = "+";
            if (files[i].isSkipped())
                tmp = "!";
            out.print(tmp + ") ");
            if (files[i] != null) {
                long fLen = files[i].getLength();
                if (fLen > 0) {
                    DecimalFormat df = new DecimalFormat("000.0%");
                    out.print(df.format(files[i].getDownloaded() * 1.0 / fLen));
                    out.println("\t" + files[i].getFile(true).getName());
                } else
                    out.println("Info not available.");
            } else
                out.println("Info not available.");
        }
    } else {
        out.println("  Info not available.");
    }
    for (String arg : args) {
        arg = arg.toLowerCase();
        if (arg.startsWith("pie")) {
            out.println("Pieces");
            PEPeerManager pm = dm.getPeerManager();
            if (pm != null) {
                PiecePicker picker = pm.getPiecePicker();
                PEPiece[] pieces = pm.getPieces();
                String line = "";
                for (int i = 0; i < pieces.length; i++) {
                    String str = picker.getPieceString(i);
                    line += (line.length() == 0 ? (i + " ") : ",") + str;
                    PEPiece piece = pieces[i];
                    if (piece != null) {
                        line += ":" + piece.getString();
                    }
                    if ((i + 1) % 10 == 0) {
                        out.println(line);
                        line = "";
                    }
                }
                if (line.length() > 0) {
                    out.println(line);
                }
            }
        } else if (arg.startsWith("pee")) {
            out.println("Peers");
            PEPeerManager pm = dm.getPeerManager();
            if (pm != null) {
                List<PEPeer> peers = pm.getPeers();
                out.println("\tConnected to " + peers.size() + " peers");
                for (PEPeer peer : peers) {
                    PEPeerStats stats = peer.getStats();
                    System.out.println("\t\t" + peer.getIp() + ", in=" + (peer.isIncoming() ? "Y" : "N") + ", prot=" + peer.getProtocol() + ", choked=" + (peer.isChokingMe() ? "Y" : "N") + ", up=" + DisplayFormatters.formatByteCountToKiBEtcPerSec(stats.getDataSendRate() + stats.getProtocolSendRate()) + ", down=" + DisplayFormatters.formatByteCountToKiBEtcPerSec(stats.getDataReceiveRate() + stats.getProtocolReceiveRate()) + ", in_req=" + peer.getIncomingRequestCount() + ", out_req=" + peer.getOutgoingRequestCount());
                }
            }
        }
    }
    out.println("> -----");
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) PEPeer(com.biglybt.core.peer.PEPeer) Category(com.biglybt.core.category.Category) PiecePicker(com.biglybt.core.peermanager.piecepicker.PiecePicker) DecimalFormat(java.text.DecimalFormat) PEPeerStats(com.biglybt.core.peer.PEPeerStats) PEPiece(com.biglybt.core.peer.PEPiece) TRTrackerAnnouncer(com.biglybt.core.tracker.client.TRTrackerAnnouncer) PEPeerManager(com.biglybt.core.peer.PEPeerManager) ArrayList(java.util.ArrayList) List(java.util.List) Tag(com.biglybt.core.tag.Tag)

Example 82 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class RemotePieceDistributionView method dataSourceChanged.

/* (non-Javadoc)
	 * @see com.biglybt.ui.swt.views.PieceDistributionView#dataSourceChanged(java.lang.Object)
	 */
@Override
public void dataSourceChanged(Object newDataSource) {
    if (newDataSource instanceof Object[] && ((Object[]) newDataSource).length > 0) {
        newDataSource = ((Object[]) newDataSource)[0];
    }
    if (newDataSource instanceof PEPeer) {
        peer = (PEPeer) newDataSource;
        pem = peer.getManager();
    } else {
        peer = null;
        pem = null;
    }
    Utils.execSWTThread(new AERunnable() {

        @Override
        public void runSupport() {
            refresh();
        }
    });
}
Also used : AERunnable(com.biglybt.core.util.AERunnable) PEPeer(com.biglybt.core.peer.PEPeer)

Example 83 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class PieceInfoView method refreshInfoCanvas.

protected void refreshInfoCanvas() {
    synchronized (PieceInfoView.this) {
        alreadyFilling = false;
    }
    if (pieceInfoCanvas == null || pieceInfoCanvas.isDisposed() || !pieceInfoCanvas.isVisible()) {
        return;
    }
    pieceInfoCanvas.layout(true);
    Rectangle bounds = pieceInfoCanvas.getClientArea();
    if (bounds.width <= 0 || bounds.height <= 0) {
        topLabelLHS = "";
        updateTopLabel();
        return;
    }
    if (dlm == null) {
        GC gc = new GC(pieceInfoCanvas);
        gc.fillRectangle(bounds);
        gc.dispose();
        topLabelLHS = MessageText.getString("view.one.download.only");
        topLabelRHS = "";
        updateTopLabel();
        return;
    }
    PEPeerManager pm = dlm.getPeerManager();
    DiskManager dm = dlm.getDiskManager();
    if (pm == null || dm == null) {
        GC gc = new GC(pieceInfoCanvas);
        gc.fillRectangle(bounds);
        gc.dispose();
        topLabelLHS = "";
        updateTopLabel();
        return;
    }
    int iNumCols = bounds.width / BLOCK_SIZE;
    int iNeededHeight = (((dm.getNbPieces() - 1) / iNumCols) + 1) * BLOCK_SIZE;
    if (img != null && !img.isDisposed()) {
        Rectangle imgBounds = img.getBounds();
        if (imgBounds.width != bounds.width || imgBounds.height != iNeededHeight) {
            oldBlockInfo = null;
            img.dispose();
            img = null;
        }
    }
    DiskManagerPiece[] dm_pieces = dm.getPieces();
    PEPiece[] currentDLPieces = pm.getPieces();
    byte[] uploadingPieces = new byte[dm_pieces.length];
    // find upload pieces
    for (PEPeer peer : pm.getPeers()) {
        int[] peerRequestedPieces = peer.getIncomingRequestedPieceNumbers();
        if (peerRequestedPieces != null && peerRequestedPieces.length > 0) {
            int pieceNum = peerRequestedPieces[0];
            if (uploadingPieces[pieceNum] < 2)
                uploadingPieces[pieceNum] = 2;
            for (int j = 1; j < peerRequestedPieces.length; j++) {
                pieceNum = peerRequestedPieces[j];
                if (uploadingPieces[pieceNum] < 1)
                    uploadingPieces[pieceNum] = 1;
            }
        }
    }
    if (sc.getMinHeight() != iNeededHeight) {
        sc.setMinHeight(iNeededHeight);
        sc.layout(true, true);
        bounds = pieceInfoCanvas.getClientArea();
    }
    int[] availability = pm.getAvailability();
    int minAvailability = Integer.MAX_VALUE;
    int minAvailability2 = Integer.MAX_VALUE;
    if (availability != null && availability.length > 0) {
        for (int anAvailability : availability) {
            if (anAvailability != 0 && anAvailability < minAvailability) {
                minAvailability2 = minAvailability;
                minAvailability = anAvailability;
                if (minAvailability == 1) {
                    break;
                }
            }
        }
    }
    if (img == null) {
        img = new Image(pieceInfoCanvas.getDisplay(), bounds.width, iNeededHeight);
        oldBlockInfo = null;
    }
    GC gcImg = new GC(img);
    BlockInfo[] newBlockInfo = new BlockInfo[dm_pieces.length];
    int iRow = 0;
    try {
        // use advanced capabilities for faster drawText
        gcImg.setAdvanced(true);
        if (oldBlockInfo == null) {
            gcImg.setBackground(pieceInfoCanvas.getBackground());
            gcImg.fillRectangle(0, 0, bounds.width, iNeededHeight);
        }
        int selectionStart = Integer.MAX_VALUE;
        int selectionEnd = Integer.MIN_VALUE;
        if (selectedPiece != -1) {
            if (selectedPieceShowFile) {
                DMPieceList l = dm.getPieceList(selectedPiece);
                for (int i = 0; i < l.size(); i++) {
                    DMPieceMapEntry entry = l.get(i);
                    DiskManagerFileInfo info = entry.getFile();
                    int first = info.getFirstPieceNumber();
                    int last = info.getLastPieceNumber();
                    if (first < selectionStart) {
                        selectionStart = first;
                    }
                    if (last > selectionEnd) {
                        selectionEnd = last;
                    }
                }
            }
        }
        gcImg.setFont(font);
        int iCol = 0;
        for (int i = 0; i < dm_pieces.length; i++) {
            if (iCol >= iNumCols) {
                iCol = 0;
                iRow++;
            }
            BlockInfo newInfo = newBlockInfo[i] = new BlockInfo();
            if (i >= selectionStart && i <= selectionEnd) {
                newInfo.selected = true;
            }
            boolean done = dm_pieces[i].isDone();
            int iXPos = iCol * BLOCK_SIZE + 1;
            int iYPos = iRow * BLOCK_SIZE + 1;
            if (done) {
                newInfo.haveWidth = BLOCK_FILLSIZE;
            } else {
                // !done
                boolean partiallyDone = dm_pieces[i].getNbWritten() > 0;
                int width = BLOCK_FILLSIZE;
                if (partiallyDone) {
                    int iNewWidth = (int) (((float) dm_pieces[i].getNbWritten() / dm_pieces[i].getNbBlocks()) * width);
                    if (iNewWidth >= width)
                        iNewWidth = width - 1;
                    else if (iNewWidth <= 0)
                        iNewWidth = 1;
                    newInfo.haveWidth = iNewWidth;
                }
            }
            if (currentDLPieces[i] != null && currentDLPieces[i].hasUndownloadedBlock()) {
                newInfo.showDown = currentDLPieces[i].getNbRequests() == 0 ? SHOW_SMALL : SHOW_BIG;
            }
            if (uploadingPieces[i] > 0) {
                newInfo.showUp = uploadingPieces[i] < 2 ? SHOW_SMALL : SHOW_BIG;
            }
            if (availability != null) {
                newInfo.availNum = availability[i];
                if (minAvailability2 == availability[i]) {
                    newInfo.availDotted = true;
                }
            } else {
                newInfo.availNum = -1;
            }
            if (oldBlockInfo != null && i < oldBlockInfo.length && oldBlockInfo[i].sameAs(newInfo)) {
                iCol++;
                continue;
            }
            if (newInfo.selected) {
                Color fc = blockColors[BLOCKCOLOR_SHOWFILE];
                gcImg.setBackground(fc);
                gcImg.fillRectangle(iCol * BLOCK_SIZE, iRow * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);
                if (fc != file_color) {
                    file_color = fc;
                    file_color_faded = Colors.getInstance().getLighterColor(fc, 75);
                }
                gcImg.setBackground(file_color_faded);
                gcImg.fillRectangle(iXPos + newInfo.haveWidth, iYPos, BLOCK_FILLSIZE - newInfo.haveWidth, BLOCK_FILLSIZE);
            } else {
                gcImg.setBackground(pieceInfoCanvas.getBackground());
                gcImg.fillRectangle(iCol * BLOCK_SIZE, iRow * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);
                gcImg.setBackground(blockColors[BLOCKCOLOR_HAVE]);
                gcImg.fillRectangle(iXPos, iYPos, newInfo.haveWidth, BLOCK_FILLSIZE);
                gcImg.setBackground(blockColors[BLOCKCOLORL_NOHAVE]);
                gcImg.fillRectangle(iXPos + newInfo.haveWidth, iYPos, BLOCK_FILLSIZE - newInfo.haveWidth, BLOCK_FILLSIZE);
            }
            if (newInfo.showDown > 0) {
                drawDownloadIndicator(gcImg, iXPos, iYPos, newInfo.showDown == SHOW_SMALL);
            }
            if (newInfo.showUp > 0) {
                drawUploadIndicator(gcImg, iXPos, iYPos, newInfo.showUp == SHOW_SMALL);
            }
            if (newInfo.availNum != -1) {
                if (minAvailability == newInfo.availNum) {
                    gcImg.setForeground(blockColors[BLOCKCOLOR_AVAILCOUNT]);
                    gcImg.drawRectangle(iXPos - 1, iYPos - 1, BLOCK_FILLSIZE + 1, BLOCK_FILLSIZE + 1);
                }
                if (minAvailability2 == newInfo.availNum) {
                    gcImg.setLineStyle(SWT.LINE_DOT);
                    gcImg.setForeground(blockColors[BLOCKCOLOR_AVAILCOUNT]);
                    gcImg.drawRectangle(iXPos - 1, iYPos - 1, BLOCK_FILLSIZE + 1, BLOCK_FILLSIZE + 1);
                    gcImg.setLineStyle(SWT.LINE_SOLID);
                }
                String sNumber = String.valueOf(newInfo.availNum);
                Point size = gcImg.stringExtent(sNumber);
                if (newInfo.availNum < 100) {
                    int x = iXPos + (BLOCK_FILLSIZE / 2) - (size.x / 2);
                    int y = iYPos + (BLOCK_FILLSIZE / 2) - (size.y / 2);
                    gcImg.setForeground(blockColors[BLOCKCOLOR_AVAILCOUNT]);
                    gcImg.drawText(sNumber, x, y, true);
                }
            }
            iCol++;
        }
        oldBlockInfo = newBlockInfo;
    } catch (Exception e) {
        Logger.log(new LogEvent(LogIDs.GUI, "drawing piece map", e));
    } finally {
        gcImg.dispose();
    }
    topLabelLHS = MessageText.getString("PiecesView.BlockView.Header", new String[] { "" + iNumCols, "" + (iRow + 1), "" + dm_pieces.length });
    PiecePicker picker = pm.getPiecePicker();
    int seq_info = picker.getSequentialInfo();
    if (seq_info != 0) {
        topLabelLHS += "; seq=" + seq_info;
    }
    String egm_info = picker.getEGMInfo();
    if (egm_info != null) {
        topLabelLHS += "; EGM=" + egm_info;
    }
    updateTopLabel();
    pieceInfoCanvas.redraw();
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer) PiecePicker(com.biglybt.core.peermanager.piecepicker.PiecePicker) DiskManager(com.biglybt.core.disk.DiskManager) DiskManagerPiece(com.biglybt.core.disk.DiskManagerPiece) DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) LogEvent(com.biglybt.core.logging.LogEvent) DMPieceList(com.biglybt.core.disk.impl.piecemapper.DMPieceList) PEPiece(com.biglybt.core.peer.PEPiece) DMPieceMapEntry(com.biglybt.core.disk.impl.piecemapper.DMPieceMapEntry) PEPeerManager(com.biglybt.core.peer.PEPeerManager)

Example 84 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class TransferStatsView method refreshConnectionPanel.

private void refreshConnectionPanel() {
    if (global_manager == null) {
        return;
    }
    int total_connections = 0;
    int total_con_queued = 0;
    int total_con_blocked = 0;
    int total_con_unchoked = 0;
    int total_data_queued = 0;
    int total_in = 0;
    List<DownloadManager> dms = global_manager.getDownloadManagers();
    for (DownloadManager dm : dms) {
        PEPeerManager pm = dm.getPeerManager();
        if (pm != null) {
            total_data_queued += pm.getBytesQueuedForUpload();
            total_connections += pm.getNbPeers() + pm.getNbSeeds();
            total_con_queued += pm.getNbPeersWithUploadQueued();
            total_con_blocked += pm.getNbPeersWithUploadBlocked();
            total_con_unchoked += pm.getNbPeersUnchoked();
            total_in += pm.getNbRemoteTCPConnections() + pm.getNbRemoteUDPConnections() + pm.getNbRemoteUTPConnections();
        }
    }
    connection_label.setText(MessageText.getString("SpeedView.stats.con_details", new String[] { String.valueOf(total_connections) + "[" + MessageText.getString("label.in").toLowerCase() + ":" + total_in + "]", String.valueOf(total_con_unchoked), String.valueOf(total_con_queued), String.valueOf(total_con_blocked) }));
    connection_graphic.addIntsValue(new int[] { total_connections, total_con_unchoked, total_con_queued, total_con_blocked });
    upload_label.setText(MessageText.getString("SpeedView.stats.upload_details", new String[] { DisplayFormatters.formatByteCountToKiBEtc(total_data_queued) }));
    upload_graphic.addIntValue(total_data_queued);
    upload_graphic.refresh(false);
    connection_graphic.refresh(false);
    if (con_folder.getSelectionIndex() == 1) {
        long now = SystemTime.getMonotonousTime();
        if (now - last_route_update >= 2 * 1000) {
            last_route_update = now;
            NetworkAdmin na = NetworkAdmin.getSingleton();
            Map<InetAddress, String> ip_to_name_map = new HashMap<>();
            Map<String, RouteInfo> name_to_route_map = new HashMap<>();
            RouteInfo udp_info = null;
            RouteInfo unknown_info = null;
            List<PRUDPPacketHandler> udp_handlers = PRUDPPacketHandlerFactory.getHandlers();
            InetAddress udp_bind_ip = null;
            for (PRUDPPacketHandler handler : udp_handlers) {
                if (handler.hasPrimordialHandler()) {
                    udp_bind_ip = handler.getBindIP();
                    if (udp_bind_ip != null) {
                        if (udp_bind_ip.isAnyLocalAddress()) {
                            udp_bind_ip = null;
                        }
                    }
                }
            }
            for (DownloadManager dm : dms) {
                PEPeerManager pm = dm.getPeerManager();
                if (pm != null) {
                    List<PEPeer> peers = pm.getPeers();
                    for (PEPeer p : peers) {
                        NetworkConnection nc = PluginCoreUtils.unwrap(p.getPluginConnection());
                        boolean done = false;
                        if (nc != null) {
                            Transport transport = nc.getTransport();
                            if (transport != null) {
                                InetSocketAddress notional_address = nc.getEndpoint().getNotionalAddress();
                                String ip = AddressUtils.getHostAddress(notional_address);
                                String network = AENetworkClassifier.categoriseAddress(ip);
                                if (network == AENetworkClassifier.AT_PUBLIC) {
                                    if (transport.isTCP()) {
                                        TransportStartpoint start = transport.getTransportStartpoint();
                                        if (start != null) {
                                            InetSocketAddress socket_address = start.getProtocolStartpoint().getAddress();
                                            if (socket_address != null) {
                                                InetAddress address = socket_address.getAddress();
                                                String name;
                                                if (address.isAnyLocalAddress()) {
                                                    name = "* (TCP)";
                                                } else {
                                                    name = ip_to_name_map.get(address);
                                                }
                                                if (name == null) {
                                                    name = na.classifyRoute(address);
                                                    ip_to_name_map.put(address, name);
                                                }
                                                if (transport.isSOCKS()) {
                                                    name += " (SOCKS)";
                                                }
                                                RouteInfo info = name_to_route_map.get(name);
                                                if (info == null) {
                                                    info = new RouteInfo(name);
                                                    name_to_route_map.put(name, info);
                                                    route_last_seen.put(name, now);
                                                }
                                                info.update(p);
                                                done = true;
                                            }
                                        }
                                    } else {
                                        if (udp_bind_ip != null) {
                                            RouteInfo info;
                                            String name = ip_to_name_map.get(udp_bind_ip);
                                            if (name == null) {
                                                name = na.classifyRoute(udp_bind_ip);
                                                ip_to_name_map.put(udp_bind_ip, name);
                                                info = name_to_route_map.get(name);
                                                route_last_seen.put(name, now);
                                                if (info == null) {
                                                    info = new RouteInfo(name);
                                                    name_to_route_map.put(name, info);
                                                }
                                            } else {
                                                info = name_to_route_map.get(name);
                                            }
                                            info.update(p);
                                            done = true;
                                        } else {
                                            if (udp_info == null) {
                                                udp_info = new RouteInfo("* (UDP)");
                                                name_to_route_map.put(udp_info.getName(), udp_info);
                                                route_last_seen.put(udp_info.getName(), now);
                                            }
                                            udp_info.update(p);
                                            done = true;
                                        }
                                    }
                                } else {
                                    RouteInfo info = name_to_route_map.get(network);
                                    if (info == null) {
                                        info = new RouteInfo(network);
                                        name_to_route_map.put(network, info);
                                        route_last_seen.put(network, now);
                                    }
                                    info.update(p);
                                    done = true;
                                }
                            }
                        }
                        if (!done) {
                            if (unknown_info == null) {
                                unknown_info = new RouteInfo("Pending");
                                name_to_route_map.put(unknown_info.getName(), unknown_info);
                                route_last_seen.put(unknown_info.getName(), now);
                            }
                            unknown_info.update(p);
                        }
                    }
                }
            }
            List<RouteInfo> rows = new ArrayList<>();
            Iterator<Map.Entry<String, Long>> it = route_last_seen.entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry<String, Long> entry = it.next();
                long when = entry.getValue();
                if (now - when > 60 * 1000) {
                    it.remove();
                } else if (when != now) {
                    rows.add(new RouteInfo(entry.getKey()));
                }
            }
            rows.addAll(name_to_route_map.values());
            Collections.sort(rows, new Comparator<RouteInfo>() {

                @Override
                public int compare(RouteInfo o1, RouteInfo o2) {
                    String n1 = o1.getName();
                    String n2 = o2.getName();
                    // wildcard and pending to the bottom
                    if (n1.startsWith("*") || n1.equals("Pending")) {
                        n1 = "zzzz" + n1;
                    }
                    if (n2.startsWith("*") || n2.equals("Pending")) {
                        n2 = "zzzz" + n2;
                    }
                    return (n1.compareTo(n2));
                }
            });
            buildRouteComponent(rows.size());
            for (int i = 0; i < rows.size(); i++) {
                RouteInfo info = rows.get(i);
                route_labels[i][0].setText(info.getName());
                route_labels[i][1].setText(info.getIncomingString());
                route_labels[i][2].setText(info.getOutgoingString());
            }
            buildRouteComponent(rows.size());
        }
    }
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer) HashMap(java.util.HashMap) InetSocketAddress(java.net.InetSocketAddress) ArrayList(java.util.ArrayList) DownloadManager(com.biglybt.core.download.DownloadManager) NetworkAdmin(com.biglybt.core.networkmanager.admin.NetworkAdmin) TransportStartpoint(com.biglybt.core.networkmanager.TransportStartpoint) NetworkConnection(com.biglybt.core.networkmanager.NetworkConnection) Point(org.eclipse.swt.graphics.Point) TransportStartpoint(com.biglybt.core.networkmanager.TransportStartpoint) PRUDPPacketHandler(com.biglybt.net.udp.uc.PRUDPPacketHandler) PEPeerManager(com.biglybt.core.peer.PEPeerManager) Transport(com.biglybt.core.networkmanager.Transport) InetAddress(java.net.InetAddress) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PEPeer (com.biglybt.core.peer.PEPeer)84 PEPeerManager (com.biglybt.core.peer.PEPeerManager)18 DownloadManager (com.biglybt.core.download.DownloadManager)11 ArrayList (java.util.ArrayList)11 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)5 AERunnable (com.biglybt.core.util.AERunnable)5 PEPiece (com.biglybt.core.peer.PEPiece)4 List (java.util.List)4 Image (org.eclipse.swt.graphics.Image)4 DiskManager (com.biglybt.core.disk.DiskManager)3 GlobalManager (com.biglybt.core.global.GlobalManager)3 PEPeerStats (com.biglybt.core.peer.PEPeerStats)3 PEPeerTransport (com.biglybt.core.peer.impl.PEPeerTransport)3 TOTorrent (com.biglybt.core.torrent.TOTorrent)3 Point (org.eclipse.swt.graphics.Point)3 DiskManagerPiece (com.biglybt.core.disk.DiskManagerPiece)2 DownloadManagerPeerListener (com.biglybt.core.download.DownloadManagerPeerListener)2 PiecePicker (com.biglybt.core.peermanager.piecepicker.PiecePicker)2 BitFlags (com.biglybt.core.peermanager.piecepicker.util.BitFlags)2 Tag (com.biglybt.core.tag.Tag)2