public String toString() { return "dsee Message: " + "vin: " + vin.toString() + " - " + addr.toString(); } }
@Override public String toString() { PeerAddress addr = getAddress(); // if null, it's a user-provided NetworkConnection object return addr == null ? "Peer()" : addr.toString(); }
@Override public String toString() { PeerAddress addr = getAddress(); // if null, it's a user-provided NetworkConnection object return addr == null ? "Peer()" : addr.toString(); }
@Override public String toString() { PeerAddress addr = getAddress(); // if null, it's a user-provided NetworkConnection object return addr == null ? "Peer()" : addr.toString(); }
@Override public String toString() { PeerAddress addr = getAddress(); // if null, it's a user-provided NetworkConnection object return addr == null ? "Peer()" : addr.toString(); }
/** Catch any exceptions, logging them and then closing the channel. */ private void exceptionCaught(Exception e) { PeerAddress addr = getAddress(); String s = addr == null ? "?" : addr.toString(); if (e instanceof ConnectException || e instanceof IOException) { // Short message for network errors log.info(s + " - " + e.getMessage()); } else { log.warn(s + " - ", e); Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(Thread.currentThread(), e); } close(); } }
/** Catch any exceptions, logging them and then closing the channel. */ private void exceptionCaught(Exception e) { PeerAddress addr = getAddress(); String s = addr == null ? "?" : addr.toString(); if (e instanceof ConnectException || e instanceof IOException) { // Short message for network errors log.info(s + " - " + e.getMessage()); } else { log.warn(s + " - ", e); Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(Thread.currentThread(), e); } close(); } }
/** Catch any exceptions, logging them and then closing the channel. */ private void exceptionCaught(Exception e) { PeerAddress addr = getAddress(); String s = addr == null ? "?" : addr.toString(); if (e instanceof ConnectException || e instanceof IOException) { // Short message for network errors log.info(s + " - " + e.getMessage()); } else { log.warn(s + " - ", e); Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(Thread.currentThread(), e); } close(); } }
/** Catch any exceptions, logging them and then closing the channel. */ private void exceptionCaught(Exception e) { PeerAddress addr = getAddress(); String s = addr == null ? "?" : addr.toString(); if (e instanceof ConnectException || e instanceof IOException) { // Short message for network errors log.info(s + " - " + e.getMessage()); } else { log.warn(s + " - ", e); Thread.UncaughtExceptionHandler handler = Threading.uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(Thread.currentThread(), e); } close(); } }
/** * Ping all connected peers to see if there is an active network connection * * @return true is two or more peers respond to the ping */ public boolean pingPeers() { List<Peer> connectedPeers = peerGroup.getConnectedPeers(); int numberOfSuccessfulPings = 0; if (connectedPeers != null) { for (Peer peer : connectedPeers) { log.debug("Ping: {}", peer.getAddress().toString()); try { ListenableFuture<Long> result = peer.ping(); result.get(4, TimeUnit.SECONDS); numberOfSuccessfulPings++; if (numberOfSuccessfulPings >= NUMBER_OF_PEERS_TO_PING) { break; } } catch (ProtocolException | InterruptedException | ExecutionException | TimeoutException e) { log.warn("Peer '" + peer.getAddress().toString() + "' failed ping test. Message was " + e.getMessage()); } } } return numberOfSuccessfulPings >= 2; }
void dsegUpdate(Peer pnode) { lock.lock(); try { if (params.getId().equals(NetworkParameters.ID_MAINNET)) { if (!(pnode.getAddress().getAddr().isAnyLocalAddress() || pnode.getAddress().getAddr().isLoopbackAddress())) { //std::map < CNetAddr, int64_t >::iterator it = mWeAskedForMasternodeList.find(pnode -> addr); Iterator<Map.Entry<NetAddress, Long>> it = mWeAskedForMasternodeList.entrySet().iterator(); if (it.hasNext()) { if (Utils.currentTimeSeconds() < it.next().getValue()){ log.info("dseg - we already asked {} for the list; skipping...", pnode.getAddress().toString()); return; } } } } pnode.sendMessage(new DarkSendEntryGetMessage(new TransactionInput(params,null, new byte[0]))); //pnode -> PushMessage("dseg", CTxIn()); long askAgain = Utils.currentTimeSeconds() + MasternodeManager.MASTERNODES_DSEG_SECONDS; mWeAskedForMasternodeList.put(new NetAddress(pnode.getAddress().getAddr()),askAgain); } finally { lock.unlock(); } }