veyron/ipc: Fix NoDischarges Option.
Change-Id: I93e40818fb834d32f54867bc3d992cdbddc7d866
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 8227e88..064f282 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -373,7 +373,11 @@
if skipResolve {
servers = []string{name}
} else {
- if resolved, err := c.ns.Resolve(ctx, name, naming.RootBlessingPatternOpt(mtPattern)); err != nil {
+ resolveOpts := []naming.ResolveOpt{naming.RootBlessingPatternOpt(mtPattern)}
+ if noDischarges {
+ resolveOpts = append(resolveOpts, vc.NoDischarges{})
+ }
+ if resolved, err := c.ns.Resolve(ctx, name, resolveOpts...); err != nil {
if verror.Is(err, naming.ErrNoSuchName.ID) {
return nil, verror.RetryRefetch, verror.Make(verror.NoServers, ctx, name)
}
diff --git a/runtimes/google/ipc/stream/vc/vc.go b/runtimes/google/ipc/stream/vc/vc.go
index 4460e6e..38d8db6 100644
--- a/runtimes/google/ipc/stream/vc/vc.go
+++ b/runtimes/google/ipc/stream/vc/vc.go
@@ -70,6 +70,7 @@
func (NoDischarges) IPCCallOpt() {}
func (NoDischarges) IPCStreamVCOpt() {}
+func (NoDischarges) NSResolveOpt() {}
var _ stream.VC = (*VC)(nil)
diff --git a/runtimes/google/naming/namespace/resolve.go b/runtimes/google/naming/namespace/resolve.go
index d010811..e1c4109 100644
--- a/runtimes/google/naming/namespace/resolve.go
+++ b/runtimes/google/naming/namespace/resolve.go
@@ -14,7 +14,7 @@
"veyron.io/veyron/veyron2/vlog"
)
-func (ns *namespace) resolveAgainstMountTable(ctx context.T, client ipc.Client, e *naming.MountEntry, pattern string) (*naming.MountEntry, error) {
+func (ns *namespace) resolveAgainstMountTable(ctx context.T, client ipc.Client, e *naming.MountEntry, pattern string, opts ...ipc.CallOpt) (*naming.MountEntry, error) {
// Try each server till one answers.
finalErr := errors.New("no servers to resolve query")
for _, s := range e.Servers {
@@ -32,7 +32,7 @@
}
// Not in cache, call the real server.
callCtx, _ := ctx.WithTimeout(callTimeout)
- call, err := client.StartCall(callCtx, pattern_and_name, "ResolveStepX", nil, options.NoResolve(true))
+ call, err := client.StartCall(callCtx, pattern_and_name, "ResolveStepX", nil, append(opts, options.NoResolve(true))...)
if err != nil {
finalErr = err
vlog.VI(2).Infof("ResolveStep.StartCall %s failed: %s", name, err)
@@ -82,6 +82,12 @@
}
pattern := getRootPattern(opts)
client := veyron2.RuntimeFromContext(ctx).Client()
+ var callOpts []ipc.CallOpt
+ for _, opt := range opts {
+ if callOpt, ok := opt.(ipc.CallOpt); ok {
+ callOpts = append(callOpts, callOpt)
+ }
+ }
// Iterate walking through mount table servers.
for remaining := ns.maxResolveDepth; remaining > 0; remaining-- {
vlog.VI(2).Infof("ResolveX(%s) loop %v", name, *e)
@@ -91,7 +97,7 @@
}
var err error
curr := e
- if e, err = ns.resolveAgainstMountTable(ctx, client, curr, pattern); err != nil {
+ if e, err = ns.resolveAgainstMountTable(ctx, client, curr, pattern, callOpts...); err != nil {
// Lots of reasons why another error can happen. We are trying
// to single out "this isn't a mount table".
if notAnMT(err) {
diff --git a/services/identity/identityd/main.go b/services/identity/identityd/main.go
index 58a5a75..c9fbb40 100644
--- a/services/identity/identityd/main.go
+++ b/services/identity/identityd/main.go
@@ -114,6 +114,7 @@
ClientSecret: clientSecret,
BlessingLogReader: blessingLogReader,
RevocationManager: revocationManager,
+ DischargerLocation: naming.JoinAddressName(published[0], dischargerService),
MacaroonBlessingService: naming.JoinAddressName(published[0], macaroonService),
})
if err != nil {