Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a407378

Browse files
committed
Minor improvements
1 parent bcad339 commit a407378

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/java/com/rampatra/blockchain/MessageHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.rampatra.blockchain;
22

3+
import sun.net.ConnectionResetException;
4+
35
import java.io.IOException;
46
import java.io.ObjectInputStream;
57
import java.io.ObjectOutputStream;
68
import java.net.Socket;
9+
import java.net.SocketException;
710

811
/**
912
* @author rampatra
@@ -35,7 +38,9 @@ public void run() {
3538
in.close();
3639
out.close();
3740
} catch (Exception e) {
38-
throw new RuntimeException(e);
41+
if (!(e instanceof SocketException)) {
42+
throw new RuntimeException(e);
43+
}
3944
}
4045
}
4146

src/main/java/com/rampatra/blockchain/P2P.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static void showPeers() {
6161

6262
public static void showPeersWithBlockchain() {
6363
for (int i = 0; i < peers.size(); i++) {
64-
System.out.println("Peer " + (i + 1) + ": " + peers.get(i).getBlockchain());
64+
System.out.println("Peer " + (i + 1) + " (" + peers.get(i).getPort() + "): " + peers.get(i).getBlockchain());
6565
}
6666
}
6767
}

0 commit comments

Comments
 (0)