Commit 5c8fc02f authored by hudangwei's avatar hudangwei

添加收包超时处理

parent 939877ae
...@@ -121,7 +121,7 @@ func NewClient(confFile string) (*Client, error) { ...@@ -121,7 +121,7 @@ func NewClient(confFile string) (*Client, error) {
return c, nil return c, nil
} }
func (c *Client) Call(service, method string, args interface{}, reply interface{}) error { func (c *Client) Call(addr, protocol, service, method string, args interface{}, reply interface{}) error {
b := &GettyRPCRequest{} b := &GettyRPCRequest{}
b.header.Service = service b.header.Service = service
b.header.Method = method b.header.Method = method
...@@ -134,7 +134,7 @@ func (c *Client) Call(service, method string, args interface{}, reply interface{ ...@@ -134,7 +134,7 @@ func (c *Client) Call(service, method string, args interface{}, reply interface{
resp := NewPendingResponse() resp := NewPendingResponse()
resp.reply = reply resp.reply = reply
session := c.selectSession() session := c.selectSession(protocol, addr)
if session == nil { if session == nil {
return errSessionNotExist return errSessionNotExist
} }
...@@ -165,8 +165,12 @@ func (c *Client) Close() { ...@@ -165,8 +165,12 @@ func (c *Client) Close() {
c.registry = nil c.registry = nil
} }
func (c *Client) selectSession() getty.Session { func (c *Client) selectSession(protocol, addr string) getty.Session {
return nil rpcConn, err := c.pool.getConn(protocol, addr)
if err != nil {
return nil
}
return rpcConn.selectSession()
} }
func (c *Client) heartbeat(session getty.Session) error { func (c *Client) heartbeat(session getty.Session) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment