(ctx *cli.Context)
| 367 | } |
| 368 | |
| 369 | func initLocalRpc(ctx *cli.Context) error { |
| 370 | if !ctx.GlobalBool(utils.GetFlagName(utils.RPCLocalEnableFlag)) { |
| 371 | return nil |
| 372 | } |
| 373 | var err error |
| 374 | exitCh := make(chan interface{}, 0) |
| 375 | go func() { |
| 376 | err = localrpc.StartLocalServer() |
| 377 | close(exitCh) |
| 378 | }() |
| 379 | |
| 380 | flag := false |
| 381 | select { |
| 382 | case <-exitCh: |
| 383 | if !flag { |
| 384 | return err |
| 385 | } |
| 386 | case <-time.After(time.Millisecond * 5): |
| 387 | flag = true |
| 388 | } |
| 389 | |
| 390 | log.Infof("Local rpc init success") |
| 391 | return nil |
| 392 | } |
| 393 | |
| 394 | func initRestful(ctx *cli.Context) { |
| 395 | if !config.DefConfig.Restful.EnableHttpRestful { |
no test coverage detected