ing
This commit is contained in:
parent
93cffbb1e5
commit
ef97f1fcd1
@ -25,8 +25,8 @@ type Client interface {
|
|||||||
Close()
|
Close()
|
||||||
|
|
||||||
Notify(method string, args interface{}) error
|
Notify(method string, args interface{}) error
|
||||||
Call(method string, args interface{}) (result interface{}, err error)
|
Call(method string, args interface{}, result interface{}) error
|
||||||
CallTimeout(method string, args interface{}, timeout time.Duration) (result interface{}, err error)
|
CallTimeout(method string, args interface{}, result interface{}, timeout time.Duration) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type client struct {
|
type client struct {
|
||||||
@ -78,11 +78,11 @@ func (c *client) Notify(method string, args interface{}) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) Call(method string, args interface{}) (result interface{}, err error) {
|
func (c *client) Call(method string, args interface{}, result interface{}) error {
|
||||||
return c.CallTimeout(method, args, c.ch.GetRequestTimeout())
|
return c.CallTimeout(method, args, result, c.ch.GetRequestTimeout())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) CallTimeout(method string, args interface{}, timeout time.Duration) (result interface{}, err error) {
|
func (c *client) CallTimeout(method string, args interface{}, result interface{}, timeout time.Duration) (err error) {
|
||||||
var cs *CallState
|
var cs *CallState
|
||||||
if cs, err = c.send(method, args, result, true, true); nil != err {
|
if cs, err = c.send(method, args, result, true, true); nil != err {
|
||||||
return
|
return
|
||||||
@ -312,8 +312,11 @@ func (c *client) responseHandle(codecResponse protocol.ClientCodecResponse) erro
|
|||||||
|
|
||||||
atomic.AddUint32(&c.pendingRequestsCount, ^uint32(0))
|
atomic.AddUint32(&c.pendingRequestsCount, ^uint32(0))
|
||||||
|
|
||||||
cs.Result = codecResponse.Result()
|
if err := codecResponse.Result(cs.Result); nil != err {
|
||||||
|
log.Printf("responseHandle:%v", err)
|
||||||
|
}
|
||||||
if err := codecResponse.Error(); nil != err {
|
if err := codecResponse.Error(); nil != err {
|
||||||
|
log.Printf("responseHandle:%v", err)
|
||||||
// cs.Error = &ClientError{
|
// cs.Error = &ClientError{
|
||||||
// Server: true,
|
// Server: true,
|
||||||
// err: fmt.Errorf("gorpc.Client: [%s]. Server error: [%s]", c.Addr, wr.Error),
|
// err: fmt.Errorf("gorpc.Client: [%s]. Server error: [%s]", c.Addr, wr.Error),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user