private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
private void processVersionAck(VersionAck m) throws ProtocolException { if (vPeerVersionMessage == null) { throw new ProtocolException("got a version ack before version"); } if (outgoingVersionHandshakeFuture.isDone()) { throw new ProtocolException("got more than one version ack"); } log.debug("{}: Outgoing version handshake complete.", this); outgoingVersionHandshakeFuture.set(this); }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readInt64() throws ProtocolException { try { long u = Utils.readInt64(payload, cursor); cursor += 8; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readUint32() throws ProtocolException { try { long u = Utils.readUint32(payload, cursor); cursor += 4; return u; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readVarInt(int offset) throws ProtocolException { try { VarInt varint = new VarInt(payload, cursor + offset); cursor += offset + varint.getOriginalSizeInBytes(); return varint.value; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
@Override protected void parse() throws ProtocolException { data = readByteArray(); if (data.length > MAX_FILTER_SIZE) throw new ProtocolException ("Bloom filter out of size range."); hashFuncs = readUint32(); if (hashFuncs > MAX_HASH_FUNCS) throw new ProtocolException("Bloom filter hash function count out of range"); nTweak = readUint32(); nFlags = readBytes(1)[0]; length = cursor - offset; }
@Override protected void parse() throws ProtocolException { data = readByteArray(); if (data.length > MAX_FILTER_SIZE) throw new ProtocolException ("Bloom filter out of size range."); hashFuncs = readUint32(); if (hashFuncs > MAX_HASH_FUNCS) throw new ProtocolException("Bloom filter hash function count out of range"); nTweak = readUint32(); nFlags = readBytes(1)[0]; length = cursor - offset; }
protected long readVarInt(int offset) throws ProtocolException { try { VarInt varint = new VarInt(payload, cursor + offset); cursor += offset + varint.getOriginalSizeInBytes(); return varint.value; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
protected long readVarInt(int offset) throws ProtocolException { try { VarInt varint = new VarInt(payload, cursor + offset); cursor += offset + varint.getOriginalSizeInBytes(); return varint.value; } catch (ArrayIndexOutOfBoundsException e) { throw new ProtocolException(e); } }
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; }