diff --git a/rpc/service.go b/rpc/service.go index cfdfba023a..8485cab3aa 100644 --- a/rpc/service.go +++ b/rpc/service.go @@ -214,19 +214,8 @@ func (c *callback) call(ctx context.Context, method string, args []reflect.Value return results[0].Interface(), nil } -// Is t context.Context or *context.Context? -func isContextType(t reflect.Type) bool { - for t.Kind() == reflect.Ptr { - t = t.Elem() - } - return t == contextType -} - // Does t satisfy the error interface? func isErrorType(t reflect.Type) bool { - for t.Kind() == reflect.Ptr { - t = t.Elem() - } return t.Implements(errorType) } @@ -245,7 +234,7 @@ func isPubSub(methodType reflect.Type) bool { if methodType.NumIn() < 2 || methodType.NumOut() != 2 { return false } - return isContextType(methodType.In(1)) && + return methodType.In(1) == contextType && isSubscriptionType(methodType.Out(0)) && isErrorType(methodType.Out(1)) }