MCPcopy Create free account
hub / github.com/CPChain/chain / reconnect

Method reconnect

api/rpc/client.go:496–510  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

494}
495
496func (c *Client) reconnect(ctx context.Context) error {
497 newconn, err := c.connectFunc(ctx)
498 if err != nil {
499 log.Debug(fmt.Sprintf("reconnect failed: %v", err))
500 return err
501 }
502 select {
503 case c.reconnected <- newconn:
504 c.writeConn = newconn
505 return nil
506 case <-c.didQuit:
507 newconn.Close()
508 return ErrClientQuit
509 }
510}
511
512// dispatch is the main loop of the client.
513// It sends read messages to waiting calls to Call and BatchCall

Callers 1

writeMethod · 0.95

Calls 2

DebugMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected