diff --git a/call.go b/call.go index 2f77175f5..5b64c2432 100644 --- a/call.go +++ b/call.go @@ -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, diff --git a/clientconn.go b/clientconn.go index 33994b167..1cf0a4c19 100644 --- a/clientconn.go +++ b/clientconn.go @@ -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) diff --git a/picker.go b/picker.go index 53ec317e0..9f34fad42 100644 --- a/picker.go +++ b/picker.go @@ -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