veyron/google/rt/runtimex: Add preferred protocols to runtime
init for profile to call.
Change-Id: Id5fe6e357258ca2fd9092df6a8858ab098fa2d92
diff --git a/profiles/static/staticinit.go b/profiles/static/staticinit.go
index 02bf67b..b435909 100644
--- a/profiles/static/staticinit.go
+++ b/profiles/static/staticinit.go
@@ -32,7 +32,7 @@
func Init(ctx *context.T) (veyron2.RuntimeX, *context.T) {
runtime := &grt.RuntimeX{}
- ctx = runtime.Init(ctx)
+ ctx = runtime.Init(ctx, nil)
log := runtime.GetLogger(ctx)
ctx = runtime.SetReservedNameDispatcher(ctx, debug.NewDispatcher(log.LogDir(), sflag.NewAuthorizerOrDie()))
diff --git a/runtimes/google/rt/runtimex.go b/runtimes/google/rt/runtimex.go
index 350a93b..9f327f0 100644
--- a/runtimes/google/rt/runtimex.go
+++ b/runtimes/google/rt/runtimex.go
@@ -68,13 +68,16 @@
// TODO(mattr): This function isn't used yet. We'll implement it later
// in the transition.
-func (*RuntimeX) Init(ctx *context.T) *context.T {
+func (*RuntimeX) Init(ctx *context.T, protocols []string) *context.T {
// TODO(mattr): Here we need to do a bunch of one time init, like parsing flags
// and reading the credentials, init logging and verror, start an appcycle manager.
// TODO(mattr): Here we need to arrange for a long of one time cleanup
// when cancel is called. Dump vtrace, shotdown signalhandling, shutdownlogging,
// shutdown the appcyclemanager.
- return nil
+ if len(protocols) > 0 {
+ ctx = context.WithValue(ctx, protocolsKey, protocols)
+ }
+ return ctx
}
func (*RuntimeX) NewEndpoint(ep string) (naming.Endpoint, error) {
@@ -300,10 +303,6 @@
return listenSpec
}
-func (*RuntimeX) SetPreferredProtocols(ctx *context.T, protocols []string) *context.T {
- return context.WithValue(ctx, protocolsKey, protocols)
-}
-
// GetPublisher returns a configuration Publisher that can be used to access
// configuration information.
func (*RuntimeX) GetPublisher(ctx *context.T) *config.Publisher {