Source:
public void initChannel(NioSocketChannel ch) throws Exception { try { if (!peerDiscoveryMode) { logger.debug("Open connection, channel: {}", isInbound() ? "inbound" : "outbound", ch.toString()); } if (isInbound()) { boolean needToDrop = false; if (ch.remoteAddress() == null) { logger.debug("Drop connection - bad remote address, channel: {}", ch.toString()); needToDrop = true; } if (!needToDrop && channelManager.isRecentlyDisconnected(ch.remoteAddress().getAddress())) { logger.debug("Drop connection - the same IP was disconnected recently, channel: {}", ch.toString()); needToDrop = true; } if (!needToDrop && nodeManager.getNodeStatistics(new Node(new byte[0], ch.remoteAddress().getHostString(), ch.remoteAddress().getPort())).isReputationPenalized()) { logger.debug("Drop connection - bad peer, channel: {}", ch.toString()); needToDrop = true; } if (!needToDrop && !channelManager.acceptingNewPeers()) { logger.debug("Drop connection - many new peers are not processed, channel: {}", ch.toString()); needToDrop = true; } if (needToDrop) { ch.disconnect(); return; } } final Channel channel = ctx.getBean(Channel.class); channel.init(ch.pipeline(), remoteId, peerDiscoveryMode, channelManager); if(!peerDiscoveryMode) { channelManager.add(channel); } ch.config().setRecvByteBufAllocator(new FixedRecvByteBufAllocator(256 * 1024)); ch.config().setOption(ChannelOption.SO_RCVBUF, 256 * 1024); ch.config().setOption(ChannelOption.SO_BACKLOG, 1024); ch.closeFuture().addListener((ChannelFutureListener) future -> { if (!peerDiscoveryMode) { channelManager.notifyDisconnect(channel); } }); } catch (Exception e) { logger.error("Unexpected error: ", e); } }

Target:
public void initChannel(NioSocketChannel ch) throws Exception { try { if (!peerDiscoveryMode) { logger.debug("Open connection, channel: {}", isInbound() ? "inbound" : "outbound", ch.toString()); } if (isInbound()) { boolean needToDrop = false; if (ch.remoteAddress() == null) { logger.debug("Drop connection - bad remote address, channel: {}", ch.toString()); needToDrop = true; } if (!needToDrop && channelManager.isRecentlyDisconnected(ch.remoteAddress().getAddress())) { logger.debug("Drop connection - the same IP was disconnected recently, channel: {}", ch.toString()); needToDrop = true; } if (!needToDrop && nodeManager.isReputationPenalized(ch.remoteAddress())) { logger.debug("Drop connection - bad peer, channel: {}", ch.toString()); needToDrop = true; } if (!needToDrop && !channelManager.acceptingNewPeers()) { logger.debug("Drop connection - many new peers are not processed, channel: {}", ch.toString()); needToDrop = true; } if (needToDrop) { ch.disconnect(); return; } } final Channel channel = ctx.getBean(Channel.class); channel.init(ch.pipeline(), remoteId, peerDiscoveryMode, channelManager); if(!peerDiscoveryMode) { channelManager.add(channel); } ch.config().setRecvByteBufAllocator(new FixedRecvByteBufAllocator(256 * 1024)); ch.config().setOption(ChannelOption.SO_RCVBUF, 256 * 1024); ch.config().setOption(ChannelOption.SO_BACKLOG, 1024); ch.closeFuture().addListener((ChannelFutureListener) future -> { if (!peerDiscoveryMode) { channelManager.notifyDisconnect(channel); } }); } catch (Exception e) { logger.error("Unexpected error: ", e); } }