MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / Call

Method Call

rpc/mux/rawcaller.go:76–103  ·  view source on GitHub ↗

Call issues client rpc call.

(method string, args interface{}, reply interface{})

Source from the content-addressed store, hash-verified

74
75// Call issues client rpc call.
76func (c *RawCaller) Call(method string, args interface{}, reply interface{}) (err error) {
77 if !c.isClientValid() {
78 if err = c.resetClient(); err != nil {
79 return
80 }
81 }
82
83 c.RLock()
84 err = c.client.Call(method, args, reply)
85 c.RUnlock()
86
87 if err != nil {
88 if err == io.EOF ||
89 err == io.ErrUnexpectedEOF ||
90 err == io.ErrClosedPipe ||
91 err == nrpc.ErrShutdown ||
92 strings.Contains(strings.ToLower(err.Error()), "shut down") ||
93 strings.Contains(strings.ToLower(err.Error()), "broken pipe") {
94 // if got EOF, retry once
95 reconnectErr := c.resetClient()
96 if reconnectErr != nil {
97 err = errors.Wrap(reconnectErr, "reconnect failed")
98 }
99 }
100 err = errors.Wrapf(err, "call %s failed", method)
101 }
102 return
103}
104
105// Close release underlying connection resources.
106func (c *RawCaller) Close() {

Callers 1

TestRawCallerFunction · 0.95

Calls 5

isClientValidMethod · 0.95
resetClientMethod · 0.95
ContainsMethod · 0.80
ErrorMethod · 0.80
CallMethod · 0.65

Tested by 1

TestRawCallerFunction · 0.76