|
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],
|
@@ -2169,11 +2169,15 @@ proc run(node: BeaconNode) {.raises: [CatchableError].} =
|
2169 | 2169 | # time to say goodbye
|
2170 | 2170 | node.stop()
|
2171 | 2171 |
|
| 2172 | +var shouldCreatePidFile*: Atomic[bool] |
| 2173 | +shouldCreatePidFile.store(true) |
| 2174 | + |
2172 | 2175 | var gPidFile: string
|
2173 | 2176 | proc createPidFile(filename: string) {.raises: [IOError].} =
|
2174 |
| - writeFile filename, $os.getCurrentProcessId() |
2175 |
| - gPidFile = filename |
2176 |
| - addExitProc proc {.noconv.} = discard io2.removeFile(gPidFile) |
| 2177 | + if shouldCreatePidFile.load(): |
| 2178 | + writeFile filename, $os.getCurrentProcessId() |
| 2179 | + gPidFile = filename |
| 2180 | + addExitProc proc {.noconv.} = discard io2.removeFile(gPidFile) |
2177 | 2181 |
|
2178 | 2182 | proc initializeNetworking(node: BeaconNode) {.async.} =
|
2179 | 2183 | node.installMessageValidators()
|
@@ -2538,7 +2542,7 @@ proc doSlashingInterchange(conf: BeaconNodeConf) {.raises: [CatchableError].} =
|
2538 | 2542 | of SlashProtCmd.`import`:
|
2539 | 2543 | conf.doSlashingImport()
|
2540 | 2544 |
|
2541 |
| -proc handleStartUpCmd(config: var BeaconNodeConf) {.raises: [CatchableError].} = |
| 2545 | +proc handleStartUpCmd*(config: var BeaconNodeConf) {.raises: [CatchableError].} = |
2542 | 2546 | # Single RNG instance for the application - will be seeded on construction
|
2543 | 2547 | # and avoid using system resources (such as urandom) after that
|
2544 | 2548 | let rng = HmacDrbgContext.new()
|
|
0 commit comments