|
8 | 8 | {.push raises: [].}
|
9 | 9 |
|
10 | 10 | import
|
11 |
| - std/[os, random, terminal, times, exitprocs], |
| 11 | + std/[os, random, terminal, times, exitprocs, atomics], |
12 | 12 | chronos, chronicles,
|
13 | 13 | metrics, metrics/chronos_httpserver,
|
14 | 14 | stew/[byteutils, io2],
|
@@ -2166,11 +2166,15 @@ proc run(node: BeaconNode) {.raises: [CatchableError].} =
|
2166 | 2166 | # time to say goodbye
|
2167 | 2167 | node.stop()
|
2168 | 2168 |
|
| 2169 | +var shouldCreatePidFile*: Atomic[bool] |
| 2170 | +shouldCreatePidFile.store(true) |
| 2171 | + |
2169 | 2172 | var gPidFile: string
|
2170 | 2173 | proc createPidFile(filename: string) {.raises: [IOError].} =
|
2171 |
| - writeFile filename, $os.getCurrentProcessId() |
2172 |
| - gPidFile = filename |
2173 |
| - addExitProc proc {.noconv.} = discard io2.removeFile(gPidFile) |
| 2174 | + if shouldCreatePidFile.load(): |
| 2175 | + writeFile filename, $os.getCurrentProcessId() |
| 2176 | + gPidFile = filename |
| 2177 | + addExitProc proc {.noconv.} = discard io2.removeFile(gPidFile) |
2174 | 2178 |
|
2175 | 2179 | proc initializeNetworking(node: BeaconNode) {.async.} =
|
2176 | 2180 | node.installMessageValidators()
|
@@ -2535,7 +2539,7 @@ proc doSlashingInterchange(conf: BeaconNodeConf) {.raises: [CatchableError].} =
|
2535 | 2539 | of SlashProtCmd.`import`:
|
2536 | 2540 | conf.doSlashingImport()
|
2537 | 2541 |
|
2538 |
| -proc handleStartUpCmd(config: var BeaconNodeConf) {.raises: [CatchableError].} = |
| 2542 | +proc handleStartUpCmd*(config: var BeaconNodeConf) {.raises: [CatchableError].} = |
2539 | 2543 | # Single RNG instance for the application - will be seeded on construction
|
2540 | 2544 | # and avoid using system resources (such as urandom) after that
|
2541 | 2545 | let rng = HmacDrbgContext.new()
|
|
0 commit comments