Activate new handler and fire read
This commit is contained in:
parent
1e3b496e8e
commit
f877d09f5a
|
@ -137,7 +137,7 @@ public class EthHandler extends SimpleChannelInboundHandler<Message> {
|
|||
*/
|
||||
private void processStatus(StatusMessage msg, ChannelHandlerContext ctx) {
|
||||
if (!Arrays.equals(msg.getGenesisHash(), Blockchain.GENESIS_HASH) || msg.getProtocolVersion() != 33)
|
||||
ctx.pipeline().remove(this);
|
||||
ctx.pipeline().remove(this); // Peer is not compatible for the 'eth' sub-protocol
|
||||
else if (msg.getNetworkId() != 0)
|
||||
msgQueue.sendMessage(new DisconnectMessage(ReasonCode.INCOMPATIBLE_NETWORK));
|
||||
else {
|
||||
|
|
|
@ -84,6 +84,7 @@ public class P2pHandler extends SimpleChannelInboundHandler<Message> {
|
|||
processPeers((PeersMessage)msg);
|
||||
break;
|
||||
default:
|
||||
ctx.fireChannelRead(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +117,7 @@ public class P2pHandler extends SimpleChannelInboundHandler<Message> {
|
|||
msgQueue.sendMessage(new DisconnectMessage(ReasonCode.INCOMPATIBLE_PROTOCOL));
|
||||
else {
|
||||
if(msg.getCapabilities().contains("eth"))
|
||||
ctx.pipeline().addLast(new EthHandler(peerListener));
|
||||
ctx.pipeline().addLast(new EthHandler(peerListener)).fireChannelActive();
|
||||
|
||||
InetAddress address = ((InetSocketAddress) ctx.channel().remoteAddress()).getAddress();
|
||||
int port = msg.getListenPort();
|
||||
|
|
Loading…
Reference in New Issue