mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 21:04:11 +00:00
fix rpc and websocket server config if they share the same port with engine api
also fixes json-rpc-engine-api server and websocket-engine-api server shutdown code, checking if they actually created or not at startup. fix #1119
This commit is contained in:
parent
b23789d107
commit
a37f8b17e2
@ -678,6 +678,10 @@ proc makeConfig*(cmdLine = commandLineParams()): NimbusConf =
|
||||
# if udpPort not set in cli, then
|
||||
result.udpPort = result.tcpPort
|
||||
|
||||
# enable rpc server or ws server if they share common port with engine api
|
||||
result.rpcEnabled = result.engineApiEnabled and (result.engineApiPort == result.rpcPort)
|
||||
result.wsEnabled = result.engineApiWsEnabled and (result.engineApiWsPort == result.wsPort)
|
||||
|
||||
when isMainModule:
|
||||
# for testing purpose
|
||||
discard makeConfig()
|
||||
|
@ -335,11 +335,13 @@ proc stop*(nimbus: NimbusNode, conf: NimbusConf) {.async, gcsafe.} =
|
||||
trace "Graceful shutdown"
|
||||
if conf.rpcEnabled:
|
||||
await nimbus.rpcServer.stop()
|
||||
if conf.engineApiEnabled:
|
||||
# nimbus.engineApiServer can be nil if conf.engineApiPort == conf.rpcPort
|
||||
if conf.engineApiEnabled and nimbus.engineApiServer.isNil.not:
|
||||
await nimbus.engineApiServer.stop()
|
||||
if conf.wsEnabled:
|
||||
nimbus.wsRpcServer.stop()
|
||||
if conf.engineApiWsEnabled:
|
||||
# nimbus.engineApiWsServer can be nil if conf.engineApiWsPort == conf.wsPort
|
||||
if conf.engineApiWsEnabled and nimbus.engineApiWsServer.isNil.not:
|
||||
nimbus.engineApiWsServer.stop()
|
||||
if conf.graphqlEnabled:
|
||||
await nimbus.graphqlServer.stop()
|
||||
|
@ -216,7 +216,7 @@ proc seen*(sn: Worker; bh: BlockHash; bn: BlockNumber) =
|
||||
# -----------
|
||||
|
||||
import
|
||||
../../../tests/replay/pp_light
|
||||
../../../../tests/replay/pp_light
|
||||
|
||||
proc pp*(bh: BlockHash): string =
|
||||
bh.Hash256.pp
|
||||
|
Loading…
x
Reference in New Issue
Block a user