@Override public void run() { lock.lock(); checkNotNull(awaitingFreshFilter); GetDataMessage getdata = new GetDataMessage(params); for (Sha256Hash hash : awaitingFreshFilter) getdata.addFilteredBlock(hash); awaitingFreshFilter = null; lock.unlock(); log.info("Restarting chain download"); sendMessage(getdata); // TODO: This bizarre ping-after-getdata hack probably isn't necessary. // It's to ensure we know when the end of a filtered block stream of txns is, but we should just be // able to match txns with the merkleblock. Ask Matt why it's written this way. sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE))); } }, Threading.SAME_THREAD);
@Override public void run() { lock.lock(); checkNotNull(awaitingFreshFilter); GetDataMessage getdata = new GetDataMessage(params); for (Sha256Hash hash : awaitingFreshFilter) getdata.addFilteredBlock(hash); awaitingFreshFilter = null; lock.unlock(); log.info("Restarting chain download"); sendMessage(getdata); // TODO: This bizarre ping-after-getdata hack probably isn't necessary. // It's to ensure we know when the end of a filtered block stream of txns is, but we should just be // able to match txns with the merkleblock. Ask Matt why it's written this way. sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE))); } }, Threading.SAME_THREAD);
@Override public void run() { lock.lock(); checkNotNull(awaitingFreshFilter); GetDataMessage getdata = new GetDataMessage(params); for (Sha256Hash hash : awaitingFreshFilter) getdata.addFilteredBlock(hash); awaitingFreshFilter = null; lock.unlock(); log.info("Restarting chain download"); sendMessage(getdata); // TODO: This bizarre ping-after-getdata hack probably isn't necessary. // It's to ensure we know when the end of a filtered block stream of txns is, but we should just be // able to match txns with the merkleblock. Ask Matt why it's written this way. sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE))); } }, Threading.SAME_THREAD);
@Override public void run() { lock.lock(); checkNotNull(awaitingFreshFilter); GetDataMessage getdata = new GetDataMessage(params); for (Sha256Hash hash : awaitingFreshFilter) getdata.addFilteredBlock(hash); awaitingFreshFilter = null; lock.unlock(); log.info("Restarting chain download"); sendMessage(getdata); // TODO: This bizarre ping-after-getdata hack probably isn't necessary. // It's to ensure we know when the end of a filtered block stream of txns is, but we should just be // able to match txns with the merkleblock. Ask Matt why it's written this way. sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE))); } }, Threading.SAME_THREAD);
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }
private void outboundPingAndWait(final InboundMessageQueuer p, long nonce) throws Exception { // Send a ping and wait for it to get to the other side SettableFuture<Void> pingReceivedFuture = SettableFuture.create(); p.mapPingFutures.put(nonce, pingReceivedFuture); p.peer.sendMessage(new Ping(nonce)); pingReceivedFuture.get(); p.mapPingFutures.remove(nonce); }
message = makeAddressMessage(payloadBytes, length); } else if (command.equals("ping")) { message = new Ping(params, payloadBytes); } else if (command.equals("pong")) { message = new Pong(params, payloadBytes);
message = makeAddressMessage(payloadBytes, length); } else if (command.equals("ping")) { message = new Ping(params, payloadBytes); } else if (command.equals("pong")) { message = new Pong(params, payloadBytes);
message = makeAddressMessage(payloadBytes, length); } else if (command.equals("ping")) { message = new Ping(params, payloadBytes); } else if (command.equals("pong")) { message = new Pong(params, payloadBytes);
sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE)));
message = makeAddressMessage(payloadBytes, length); } else if (command.equals("ping")) { message = new Ping(params, payloadBytes); } else if (command.equals("pong")) { message = new Pong(params, payloadBytes);
sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE)));
sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE)));
sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE)));
filterAndSend(p1, newBlocks, newFilter); inbound(p1, new Ping()); pingAndWait(p1);