Minor reformatting

This commit is contained in:
Mike Hearn 2012-10-23 20:35:55 +02:00
parent c5f8135f60
commit dd47862829
2 changed files with 4 additions and 9 deletions

View File

@ -157,15 +157,13 @@ public class Peer {
class PeerHandler extends SimpleChannelHandler { class PeerHandler extends SimpleChannelHandler {
@Override @Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
throws Exception {
super.channelClosed(ctx, e); super.channelClosed(ctx, e);
notifyDisconnect(); notifyDisconnect();
} }
@Override @Override
public void connectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) public void connectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
throws Exception {
super.connectRequested(ctx, e); super.connectRequested(ctx, e);
channel = e.getChannel(); channel = e.getChannel();
address = new PeerAddress((InetSocketAddress)e.getValue()); address = new PeerAddress((InetSocketAddress)e.getValue());
@ -173,8 +171,7 @@ public class Peer {
/** Catch any exceptions, logging them and then closing the channel. */ /** Catch any exceptions, logging them and then closing the channel. */
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
throws Exception {
if (e.getCause() instanceof ConnectException || e.getCause() instanceof IOException) { if (e.getCause() instanceof ConnectException || e.getCause() instanceof IOException) {
// Short message for network errors // Short message for network errors
log.info(toString() + " - " + e.getCause().getMessage()); log.info(toString() + " - " + e.getCause().getMessage());

View File

@ -202,9 +202,7 @@ public class PeerGroup {
Peer peer = new Peer(params, chain, ver); Peer peer = new Peer(params, chain, ver);
peer.addLifecycleListener(startupListener); peer.addLifecycleListener(startupListener);
pendingPeers.add(peer); pendingPeers.add(peer);
TCPNetworkConnection codec = TCPNetworkConnection codec = new TCPNetworkConnection(params, peer.getVersionMessage());
new TCPNetworkConnection(params,
peer.getVersionMessage());
p.addLast("codec", codec.getHandler()); p.addLast("codec", codec.getHandler());
p.addLast("peer", peer.getHandler()); p.addLast("peer", peer.getHandler());
return p; return p;