Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2703] JSON-RPC api net_services should display the actual ports #1628

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ public void verify(final Node node) {

assertThat(InetAddresses.isUriInetAddress(result.get("ws").get("host"))).isTrue();
final int wsPort = Integer.valueOf(result.get("ws").get("port"));
// TODO: Port should not be 0-valued. Refer to PAN-2703
assertThat(NetworkUtility.isValidPort(p2pPort) || wsPort == 0).isTrue();
assertThat(NetworkUtility.isValidPort(wsPort)).isTrue();

assertThat(InetAddresses.isUriInetAddress(result.get("jsonrpc").get("host"))).isTrue();
final int jsonRpcPort = Integer.valueOf(result.get("jsonrpc").get("port"));
// TODO: Port should not be 0-valued. Refer to PAN-2703
assertThat(NetworkUtility.isValidPort(p2pPort) || jsonRpcPort == 0).isTrue();
assertThat(NetworkUtility.isValidPort(jsonRpcPort)).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public void verify(final Node node) {

assertThat(InetAddresses.isUriInetAddress(result.get("jsonrpc").get("host"))).isTrue();
final int jsonrpcPort = Integer.valueOf(result.get("jsonrpc").get("port"));
// TODO: Port should not be 0-valued. Refer to PAN-2703
assertThat(NetworkUtility.isValidPort(jsonrpcPort) || jsonrpcPort == 0).isTrue();
assertThat(NetworkUtility.isValidPort(jsonrpcPort)).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ public CompletableFuture<?> start() {
res -> {
if (!res.failed()) {
resultFuture.complete(null);
final int actualPort = httpServer.actualPort();
LOG.info(
"JsonRPC service started and listening on {}:{}",
config.getHost(),
httpServer.actualPort());
"JsonRPC service started and listening on {}:{}", config.getHost(), actualPort);
config.setPort(actualPort);
return;
}
httpServer = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ private Handler<AsyncResult<HttpServer>> startHandler(final CompletableFuture<?>
return res -> {
if (res.succeeded()) {

final int actualPort = res.result().actualPort();
LOG.info(
"Websocket service started and listening on {}:{}",
configuration.getHost(),
res.result().actualPort());

actualPort);
configuration.setPort(actualPort);
resultFuture.complete(null);
} else {
resultFuture.completeExceptionally(res.cause());
Expand Down