(ctx *cli.Context)
| 343 | } |
| 344 | |
| 345 | func initRpc(ctx *cli.Context) error { |
| 346 | if !config.DefConfig.Rpc.EnableHttpJsonRpc { |
| 347 | return nil |
| 348 | } |
| 349 | var err error |
| 350 | exitCh := make(chan interface{}, 0) |
| 351 | go func() { |
| 352 | err = jsonrpc.StartRPCServer() |
| 353 | close(exitCh) |
| 354 | }() |
| 355 | |
| 356 | flag := false |
| 357 | select { |
| 358 | case <-exitCh: |
| 359 | if !flag { |
| 360 | return err |
| 361 | } |
| 362 | case <-time.After(time.Millisecond * 5): |
| 363 | flag = true |
| 364 | } |
| 365 | log.Infof("Rpc init success") |
| 366 | return nil |
| 367 | } |
| 368 | |
| 369 | func initLocalRpc(ctx *cli.Context) error { |
| 370 | if !ctx.GlobalBool(utils.GetFlagName(utils.RPCLocalEnableFlag)) { |
no test coverage detected