MCPcopy Create free account
hub / github.com/DNAProject/DNA / initLocalRpc

Function initLocalRpc

main.go:369–392  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

367}
368
369func 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
394func initRestful(ctx *cli.Context) {
395 if !config.DefConfig.Restful.EnableHttpRestful {

Callers 1

startDNAFunction · 0.85

Calls 3

GetFlagNameFunction · 0.92
StartLocalServerFunction · 0.92
InfofMethod · 0.80

Tested by

no test coverage detected