MCPcopy Index your code
hub / github.com/dearcode/candy / Start

Method Start

client/candy.go:53–72  ·  view source on GitHub ↗

Start 连接服务端.

()

Source from the content-addressed store, hash-verified

51
52// Start 连接服务端.
53func (c *CandyClient) Start() (err error) {
54 if c.conn, err = grpc.Dial(c.host, grpc.WithInsecure(), grpc.WithTimeout(networkTimeout)); err != nil {
55 return
56 }
57
58 c.api = meta.NewGateClient(c.conn)
59 if c.stream, err = c.api.Ready(context.Background(), &meta.Message{}); err != nil {
60 return
61 }
62
63 c.bhealth = true
64
65 go c.loopRecvMessage()
66
67 //健康检查
68 c.health = healthpb.NewHealthClient(c.conn)
69 go c.healthCheck()
70
71 return
72}
73
74// Stop 断开到服务器连接.
75func (c *CandyClient) Stop() error {

Callers 2

mainFunction · 0.95
TestMainFunction · 0.45

Calls 3

loopRecvMessageMethod · 0.95
healthCheckMethod · 0.95
ReadyMethod · 0.65

Tested by 1

TestMainFunction · 0.36