This commit is contained in:
iamqizhao 2015-09-25 13:32:35 -07:00
parent ec99a32572
commit 23fea5c44a
3 changed files with 6 additions and 11 deletions

View File

@ -116,10 +116,6 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
o.after(&c)
}
}()
//conn, err := cc.picker.Pick()
//if err != nil {
// return toRPCErr(err)
//}
if EnableTracing {
c.traceInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method)
defer c.traceInfo.tr.Finish()
@ -136,10 +132,6 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
}
}()
}
//callHdr := &transport.CallHdr{
// Host: conn.authority,
// Method: method,
//}
topts := &transport.Options{
Last: true,
Delay: false,

View File

@ -197,15 +197,14 @@ type ClientConn struct {
picker Picker
}
// State returns the connectivity state of the Conn used for next upcoming RPC.
// State returns the connectivity state of cc.
// This is EXPERIMENTAL API.
func (cc *ClientConn) State() ConnectivityState {
return cc.picker.State()
}
// WaitForStateChange blocks until the state changes to something other than the sourceState
// or timeout fires on the Conn used for next upcoming RPC. It returns false if the Conn is nil
// or timeout fires, and true otherwise.
// or timeout fires on cc. It returns false if timeout fires, and true otherwise.
// This is EXPERIEMENTAL API.
func (cc *ClientConn) WaitForStateChange(timeout time.Duration, sourceState ConnectivityState) bool {
return cc.picker.WaitForStateChange(timeout, sourceState)

View File

@ -10,7 +10,11 @@ type Picker interface {
// Pick returns the Conn to use for the upcoming RPC. It may return different
// Conn's up to the implementation.
Pick() (*Conn, error)
// State returns the connectivity state of the underlying connections.
State() ConnectivityState
// WaitForStateChange blocks until the state changes to something other than
// the sourceState or timeout fires on cc. It returns false if timeout fires,
// and true otherwise.
WaitForStateChange(timeout time.Duration, sourceState ConnectivityState) bool
// Close closes all the Conn's owned by this Picker.
Close() error