Package org.ethereum.net.peerdiscovery

Examples of org.ethereum.net.peerdiscovery.PeerInfo


        return null;
    }

    @Override
    public PeerInfo waitForOnlinePeer() {
        PeerInfo peer = null;
    while (peer == null) {
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        e.printStackTrace();
View Full Code Here


      }
            adaptMessageIds(capInCommon);

      InetAddress address = ((InetSocketAddress) ctx.channel().remoteAddress()).getAddress();
      int port = msg.getListenPort();
      PeerInfo confirmedPeer = new PeerInfo(address, port, msg.getPeerId());
      confirmedPeer.setOnline(false);
      confirmedPeer.getCapabilities().addAll(msg.getCapabilities());

            //todo calculate the Offsets
            worldManager.getPeerDiscovery().getPeers().add(confirmedPeer);
    }
  }
View Full Code Here

        else return String.class;
    }

    public Object getValueAt(int row, int column) {

        PeerInfo peerInfo = peerInfoList.get(row);

        if (column == 0) {
            String countryCode = peerInfo.getLocation().countryCode;

            ImageIcon flagIcon = null;
            if (countryCode != null){
                URL flagURL = ClassLoader.getSystemResource("flags/" + countryCode.toLowerCase() + ".png");
                flagIcon = new ImageIcon(flagURL);
            }
            return flagIcon;
        }
        if (column == 1)
          return peerInfo.getIp().getHostAddress();

        if (column == 2) {

            if (peerInfo.getLastAccessed() == 0)
                return "?";
            else
                return (System.currentTimeMillis() - peerInfo.getLastAccessed()) / 1000 + " seconds ago";
        }

        if (column == 3) {

            ImageIcon flagIcon = null;
            if (peerInfo.isConnected()) {
                flagIcon = Utils.getImageIcon("connected.png");
            } else {
                flagIcon = Utils.getImageIcon("disconnected.png");
            }
            return flagIcon;
View Full Code Here

            synchronized (peers){

                for (org.ethereum.net.peerdiscovery.PeerInfo peer : peers) {
                    InetAddress addr = peer.getAddress();
                    Location cr = IpGeoDB.getLocationForIp(addr);
                    peerInfoList.add(new PeerInfo(cr, addr, peer.isOnline(), peer.getLastCheckTime(),
                            peer.getHandshakeHelloMessage(), peer.getStatusMessage()));
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.ethereum.net.peerdiscovery.PeerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.