Skip to content

Commit

Permalink
Print DHT info for channels
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Feb 3, 2020
1 parent 30e7655 commit 50e4a04
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ChannelPeerMaintainer.java
Expand Up @@ -147,7 +147,21 @@ private void saveDHT(ChannelID cid, List<ByteString> dht_element_lst, ChannelPee

}

private LinkedList<ChannelPeerInfo> getAllDHTPeers(ChannelID cid, List<ByteString> dht_element_lst, Set<AddressSpecHash> connected_set)
public LinkedList<ChannelPeerInfo> getAllDHTPeers(ChannelID cid)
{
return getAllDHTPeers(cid, new HashSet<AddressSpecHash>());
}
public LinkedList<ChannelPeerInfo> getAllDHTPeers(ChannelID cid, Set<AddressSpecHash> connected_set)
{

// TODO - actually get head settings
ChannelSettings settings = null;
List<ByteString> dht_element_lst = node.getDHTStratUtil().getDHTLocations(cid, settings);

return getAllDHTPeers(cid, dht_element_lst, connected_set);
}

public LinkedList<ChannelPeerInfo> getAllDHTPeers(ChannelID cid, List<ByteString> dht_element_lst, Set<AddressSpecHash> connected_set)
{
HashMap<ByteString, SignedMessagePayload> peer_map = new HashMap<>();

Expand Down
10 changes: 10 additions & 0 deletions src/iceleaf/ChannelNodePanel.java
Expand Up @@ -5,6 +5,7 @@
import java.awt.GridBagConstraints;
import java.awt.event.ActionEvent;
import java.io.File;
import java.util.LinkedList;
import java.util.TreeMap;
import javax.swing.JButton;
import javax.swing.JLabel;
Expand All @@ -20,7 +21,9 @@
import snowblossom.channels.ChunkMapUtils;
import snowblossom.channels.MiscUtils;
import snowblossom.channels.PeerLink;
import snowblossom.channels.PrintUtil;
import snowblossom.channels.SocksServer;
import snowblossom.channels.proto.ChannelPeerInfo;
import snowblossom.iceleaf.BasePanel;
import snowblossom.iceleaf.IceLeaf;
import snowblossom.iceleaf.ThreadActionListener;
Expand Down Expand Up @@ -337,6 +340,13 @@ public void threadActionPerformed(ActionEvent e)
sb.append(" " + link);
sb.append("\n");
}
sb.append("DHT Peers:\n");
LinkedList<ChannelPeerInfo> peer_infos = node.getChannelPeerMaintainer().getAllDHTPeers(cid);
for(ChannelPeerInfo info : peer_infos)
{
sb.append(" ");
sb.append(PrintUtil.print(info));
}
}


Expand Down

0 comments on commit 50e4a04

Please sign in to comment.