Conversation
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
…o add_port_conflict_exception
fab-10
left a comment
There was a problem hiding this comment.
just a comment on the method name, then a general question, this covers listening ports of the RPC server, are the other listening ports already covered?
| return false; | ||
| } | ||
|
|
||
| public static void checkPortsAvailable(final int tcpPort) { |
There was a problem hiding this comment.
then method name says Ports so suggests that more than one port as parameter like a var arg, otherwise use the singular
There was a problem hiding this comment.
Changed the name of the method, thanks for raising that @fab-10
There was a problem hiding this comment.
Changed the approach to cover the ports we will require to initialise all the services defined in the config. So we can have a more general solution that loops through the ports and check if they are available.
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpService.java
Outdated
Show resolved
Hide resolved
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcService.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
| if (!unavailablePorts.isEmpty()) { | ||
| throw new InvalidConfigurationException( | ||
| "Port(s) '" | ||
| + unavailablePorts.toString() |
There was a problem hiding this comment.
nit: toString on unavailablePorts isn't necessary
| } | ||
|
|
||
| private void checkIfRequiredPortsAreAvailable() { | ||
| List<Integer> unavailablePorts = new ArrayList<>(); |
|
|
||
| final CompletableFuture<?> resultFuture = new CompletableFuture<>(); | ||
| try { | ||
|
|
There was a problem hiding this comment.
any reason to add the extra empty line?
util/src/main/java/org/hyperledger/besu/util/NetworkUtility.java
Outdated
Show resolved
Hide resolved
changes have been made to check port conflicts for other services
| } | ||
| } | ||
|
|
||
| public static boolean isPortAvailableForTcp(final int port) { |
| return false; | ||
| } | ||
|
|
||
| public static boolean isPortAvailableForUdp(final int port) { |
util/src/main/java/org/hyperledger/besu/util/NetworkUtility.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
| return false; | ||
| } | ||
|
|
||
| public static boolean isPortAvailable(final int port) { |
There was a problem hiding this comment.
nit: consider renaming to make to clear this is checking both udp and tcp. maybe rename to isPortAvailableForTcpAndUdp
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
PR description
Added methods to check if port is available and call before starting websockets and rpc services.
Fixed Issue(s)
Fixes #4176
Documentation
doc-change-requiredlabel to this PR ifupdates are required.
Changelog