veyron/runtimes/google/rt: Change runtime.Publisher calls to veyron2.GetPublisher(ctx).
Change-Id: I7cb0deb7d5e24a86216eb4674c0db4456fbbef4e
diff --git a/profiles/roaming/net_watcher.go b/profiles/roaming/net_watcher.go
index 022f88c..b3060db 100644
--- a/profiles/roaming/net_watcher.go
+++ b/profiles/roaming/net_watcher.go
@@ -21,6 +21,8 @@
}
defer r.Cleanup()
+ ctx := r.NewContext()
+
fmt.Println("Profile: ", r.Profile().Name())
accessible, err := netstate.GetAccessibleIPs()
@@ -42,7 +44,7 @@
}
ch := make(chan config.Setting, 10)
- settings, err := r.Publisher().ForkStream(roaming.SettingsStreamName, ch)
+ settings, err := veyron2.GetPublisher(ctx).ForkStream(roaming.SettingsStreamName, ch)
if err != nil {
r.Logger().Infof("failed to fork stream: %s", err)
}
diff --git a/profiles/static/staticinit.go b/profiles/static/staticinit.go
index c17efc5..4a48b6f 100644
--- a/profiles/static/staticinit.go
+++ b/profiles/static/staticinit.go
@@ -27,7 +27,6 @@
func init() {
commonFlags = flags.CreateAndRegister(flag.CommandLine, flags.Listen)
- // TODO(suharshs): Register the Init function here.
veyron2.RegisterProfileInit(Init)
}
diff --git a/runtimes/google/rt/runtimex.go b/runtimes/google/rt/runtimex.go
index 7062f10..6af8e88 100644
--- a/runtimes/google/rt/runtimex.go
+++ b/runtimes/google/rt/runtimex.go
@@ -6,6 +6,7 @@
_ "v.io/core/veyron/lib/stats/sysstats"
"v.io/core/veyron2"
+ "v.io/core/veyron2/config"
"v.io/core/veyron2/context"
"v.io/core/veyron2/ipc"
"v.io/core/veyron2/ipc/stream"
@@ -38,6 +39,7 @@
appCycleKey
listenSpecKey
protocolsKey
+ publisherKey
)
func init() {
@@ -57,6 +59,7 @@
ctx = context.WithValue(ctx, loggerKey, vlog.Log)
ctx = context.WithValue(ctx, principalKey, rt.principal)
ctx = context.WithValue(ctx, vtraceKey, rt.traceStore)
+ ctx = context.WithValue(ctx, publisherKey, rt.publisher)
ctx = context.WithValue(ctx, profileKey, rt.profile)
ctx = context.WithValue(ctx, appCycleKey, rt.ac)
return ctx
@@ -318,3 +321,10 @@
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 {
+ publisher, _ := ctx.Value(publisherKey).(*config.Publisher)
+ return publisher
+}