-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve p2p bind and db lock err msgs #503
Conversation
@@ -148,7 +148,8 @@ public boolean open() { | |||
} catch (Exception e) { | |||
if (e instanceof NullPointerException) { | |||
LOG.error("Failed to open the database " + this.toString() | |||
+ ". A probable cause is that the H2 database cannot access the file path.", e); | |||
+ ". A probable cause is that the H2 database cannot access the file path. " | |||
+ "Check that you do not have two instances running on the same database.", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: May be change line 152 to "Check if you have two instances running" instead of "Check that you do not" and everywhere with the same statement.
Merge branch 'fix_separate_tasks' of https://github.com/aionick/aion into fix_err_msgs
I updated this PR because its dependent PR changed, commit 5f4ecec is the only one in here to pay attention to. Only 1 file in this PR is dependent, that is P2pMgr, and the change that I've made here is in lines 213-214, a catch SocketException block. Sorry for the confusion |
@@ -992,79 +155,76 @@ public void run() { | |||
tcpServer.socket().bind(new InetSocketAddress(Node.ipBytesToStr(selfIp), selfPort)); | |||
tcpServer.register(selector, SelectionKey.OP_ACCEPT); | |||
|
|||
Thread thrdIn = new Thread(new TaskInbound(), "p2p-in"); | |||
Thread thrdIn = new Thread(getInboundInstance(), "p2p-in"); | |||
// Thread thrdIn = new Thread(new TaskInbound(), "p2p-in"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove this line
related to #69 |
public boolean isSyncSeedsOnly() { throw new IllegalStateException("not implemented."); } | ||
|
||
@Override | ||
public int getTxBroadCastRoute() { throw new IllegalStateException("not implemented."); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method should remove, also the interface class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please make sure the license for the files is correct
- (optional) it would be nice to pass a logger object to all the tasks and log the messages instead of using
System.out
; checkTaskImportBlocks.java
for reference - (optional) throughout the code I've seen many one liner if statements; I would prefer surrounding the then clause with { and }
@@ -2,6 +2,7 @@ | |||
|
|||
import static com.google.common.truth.Truth.assertThat; | |||
|
|||
import java.io.IOException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this import is not used
@@ -31,6 +31,7 @@ | |||
import java.util.Arrays; | |||
import java.util.regex.Pattern; | |||
import org.aion.p2p.INode; | |||
import org.aion.p2p.IPeerMetric; | |||
|
|||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be /**
@@ -0,0 +1,15 @@ | |||
package org.aion.p2p; | |||
|
|||
public interface IPeerMetric { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to have some java doc for this new interface
* @throws IOException IOException | ||
*/ | ||
private int readHeader(final ChannelBuffer _cb, ByteBuffer readBuffer, int cnt) | ||
throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws IOException
may be unnecessary
* @throws IOException IOException | ||
*/ | ||
private int readBody(final ChannelBuffer _cb, ByteBuffer readBuffer, int cnt) | ||
throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws IOException
may be unnecessary
addressed the comments, working on the optionals now |
Description
Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.
Fixes Issue #
Type of change
Insert x into the following checkboxes to confirm (eg. [x]):
Testing
Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.
Verification
Insert x into the following checkboxes to confirm (eg. [x]):