[CORDA-1948]: Demobench profile load fails with stack dump -- for Corda OS 3.3 -- branch release-V3 (fix) (#3992)

This commit is contained in:
Michele Sollecito 2018-09-26 15:18:34 +02:00 committed by GitHub
parent df343379d2
commit 4822638533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 14 deletions

View File

@ -41,7 +41,7 @@ class Explorer internal constructor(private val explorerController: ExplorerCont
val user = config.nodeConfig.rpcUsers[0]
val p = explorerController.process(
"--host=localhost",
"--port=${config.nodeConfig.rpcAddress.port}",
"--port=${config.nodeConfig.rpcSettings.address.port}",
"--username=${user.username}",
"--password=${user.password}")
.directory(explorerDir.toFile())

View File

@ -20,7 +20,7 @@ class InstallFactory : Controller() {
val nodeConfig = config.parseAs<NodeConfig>()
nodeConfig.p2pAddress.checkPort()
nodeConfig.rpcAddress.checkPort()
nodeConfig.rpcSettings.address.checkPort()
nodeConfig.webAddress.checkPort()
val tempDir = Files.createTempDirectory(baseDir, ".node")

View File

@ -21,8 +21,7 @@ import java.nio.file.StandardCopyOption
data class NodeConfig(
val myLegalName: CordaX500Name,
val p2pAddress: NetworkHostAndPort,
val rpcAddress: NetworkHostAndPort,
val rpcAdminAddress: NetworkHostAndPort,
val rpcSettings: NodeRpcSettings,
/** This is not used by the node but by the webserver which looks at node.conf. */
val webAddress: NetworkHostAndPort,
val notary: NotaryService?,
@ -46,8 +45,8 @@ data class NodeConfig(
val config = toConfig()
val rpcSettings = empty()
.withValue("address", ConfigValueFactory.fromAnyRef(rpcAddress.toString()))
.withValue("adminAddress", ConfigValueFactory.fromAnyRef(rpcAdminAddress.toString()))
.withValue("address", ConfigValueFactory.fromAnyRef(rpcSettings.address.toString()))
.withValue("adminAddress", ConfigValueFactory.fromAnyRef(rpcSettings.adminAddress.toString()))
.root()
return config.withoutPath("rpcAddress").withoutPath("rpcAdminAddress").withValue("rpcSettings", rpcSettings)
}

View File

@ -74,8 +74,10 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
country = location.countryCode
),
p2pAddress = nodeData.p2pPort.toLocalAddress(),
rpcAddress = nodeData.rpcPort.toLocalAddress(),
rpcAdminAddress = nodeData.rpcAdminPort.toLocalAddress(),
rpcSettings = NodeRpcSettings(
address = nodeData.rpcPort.toLocalAddress(),
adminAddress = nodeData.rpcAdminPort.toLocalAddress()
),
webAddress = nodeData.webPort.toLocalAddress(),
notary = notary,
h2port = nodeData.h2Port.value,
@ -204,7 +206,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
}
private fun updatePort(config: NodeConfig) {
val nextPort = 1 + arrayOf(config.p2pAddress.port, config.rpcAddress.port, config.webAddress.port, config.h2port).max() as Int
val nextPort = 1 + arrayOf(config.p2pAddress.port, config.rpcSettings.address.port, config.webAddress.port, config.h2port).max() as Int
port.getAndUpdate { Math.max(nextPort, it) }
}

View File

@ -0,0 +1,8 @@
package net.corda.demobench.model
import net.corda.core.utilities.NetworkHostAndPort
data class NodeRpcSettings(
val address: NetworkHostAndPort,
val adminAddress: NetworkHostAndPort
)

View File

@ -15,7 +15,7 @@ class NodeRPC(config: NodeConfigWrapper, start: (NodeConfigWrapper, CordaRPCOps)
val oneSecond = SECONDS.toMillis(1)
}
private val rpcClient = CordaRPCClient(NetworkHostAndPort("localhost", config.nodeConfig.rpcAddress.port))
private val rpcClient = CordaRPCClient(NetworkHostAndPort("localhost", config.nodeConfig.rpcSettings.address.port))
private var rpcConnection: CordaRPCConnection? = null
private val timer = Timer()

View File

@ -88,8 +88,10 @@ class NodeConfigTest {
return NodeConfig(
myLegalName = legalName,
p2pAddress = localPort(p2pPort),
rpcAddress = localPort(rpcPort),
rpcAdminAddress = localPort(rpcAdminPort),
rpcSettings = NodeRpcSettings(
address = localPort(rpcPort),
adminAddress = localPort(rpcAdminPort)
),
webAddress = localPort(webPort),
h2port = h2port,
notary = notary,

View File

@ -163,8 +163,10 @@ class NodeControllerTest {
country = "US"
),
p2pAddress = localPort(p2pPort),
rpcAddress = localPort(rpcPort),
rpcAdminAddress = localPort(rpcAdminPort),
rpcSettings = NodeRpcSettings(
address = localPort(rpcPort),
adminAddress = localPort(rpcAdminPort)
),
webAddress = localPort(webPort),
h2port = h2port,
notary = notary,