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

Method loopRecvMessage

client/candy.go:340–353  ·  view source on GitHub ↗

loopRecvMessage 一直接收服务器返回消息, 直到退出.

()

Source from the content-addressed store, hash-verified

338
339// loopRecvMessage 一直接收服务器返回消息, 直到退出.
340func (c *CandyClient) loopRecvMessage() {
341 log.Debugf("start loopRecvMessage")
342
343 for !c.stop {
344 pm, err := c.stream.Recv()
345 if err != nil {
346 // 这里不退出会死循环
347 c.handler.OnError(err.Error())
348 break
349 }
350
351 c.handler.OnRecv(int32(pm.Event), int32(pm.Operate), pm.Msg.ID, pm.Msg.Group, pm.Msg.From, pm.Msg.To, pm.Msg.Body)
352 }
353}
354
355// healthCheck 健康检查
356func (c *CandyClient) healthCheck() {

Callers 1

StartMethod · 0.95

Calls 4

RecvMethod · 0.65
OnErrorMethod · 0.65
OnRecvMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected