v23/config: move it to x/lib/pubsub.
MultiPart: 3/3
Change-Id: I3c970e2b5016faa9db51681a8dd70b8f5ded8e2e
diff --git a/profiles/internal/rpc/server.go b/profiles/internal/rpc/server.go
index d41aa64..4315e03 100644
--- a/profiles/internal/rpc/server.go
+++ b/profiles/internal/rpc/server.go
@@ -15,9 +15,9 @@
"time"
"v.io/x/lib/netstate"
+ "v.io/x/lib/pubsub"
"v.io/x/lib/vlog"
- "v.io/v23/config"
"v.io/v23/context"
"v.io/v23/namespace"
"v.io/v23/naming"
@@ -73,9 +73,9 @@
type dhcpState struct {
name string
- publisher *config.Publisher
- stream *config.Stream
- ch chan config.Setting // channel to receive dhcp settings over
+ publisher *pubsub.Publisher
+ stream *pubsub.Stream
+ ch chan pubsub.Setting // channel to receive dhcp settings over
err error // error status.
watchers map[chan<- rpc.NetworkChange]struct{}
}
@@ -420,7 +420,7 @@
watchers: make(map[chan<- rpc.NetworkChange]struct{}),
}
s.dhcpState = dhcp
- dhcp.ch = make(chan config.Setting, 10)
+ dhcp.ch = make(chan pubsub.Setting, 10)
dhcp.stream, dhcp.err = dhcp.publisher.ForkStream(dhcp.name, dhcp.ch)
if dhcp.err == nil {
// We have a goroutine to listen for dhcp changes.
@@ -610,7 +610,7 @@
}
}
-func (s *server) dhcpLoop(ch chan config.Setting) {
+func (s *server) dhcpLoop(ch chan pubsub.Setting) {
defer vlog.VI(1).Infof("rpc: Stopped listen for dhcp changes")
vlog.VI(2).Infof("rpc: dhcp loop")
for setting := range ch {
@@ -854,7 +854,7 @@
}(ln)
}
- drain := func(ch chan config.Setting) {
+ drain := func(ch chan pubsub.Setting) {
for {
select {
case v := <-ch:
diff --git a/profiles/internal/rpc/server_test.go b/profiles/internal/rpc/server_test.go
index 4e30884..c23b3bd 100644
--- a/profiles/internal/rpc/server_test.go
+++ b/profiles/internal/rpc/server_test.go
@@ -11,8 +11,9 @@
"testing"
"time"
+ "v.io/x/lib/pubsub"
+
"v.io/v23"
- "v.io/v23/config"
"v.io/v23/context"
"v.io/v23/naming"
"v.io/v23/rpc"
@@ -430,8 +431,8 @@
t.Fatal(err)
}
- publisher := config.NewPublisher()
- roaming := make(chan config.Setting)
+ publisher := pubsub.NewPublisher()
+ roaming := make(chan pubsub.Setting)
stop, err := publisher.CreateStream("TestRoaming", "TestRoaming", roaming)
if err != nil {
t.Fatal(err)
@@ -582,8 +583,8 @@
t.Fatal(err)
}
- publisher := config.NewPublisher()
- roaming := make(chan config.Setting)
+ publisher := pubsub.NewPublisher()
+ roaming := make(chan pubsub.Setting)
stop, err := publisher.CreateStream("TestWatcherDeadlock", "TestWatcherDeadlock", roaming)
if err != nil {
t.Fatal(err)
diff --git a/profiles/roaming/roaminginit.go b/profiles/roaming/roaminginit.go
index 4996320..8ec4482 100644
--- a/profiles/roaming/roaminginit.go
+++ b/profiles/roaming/roaminginit.go
@@ -8,7 +8,7 @@
// configurations, including 1-1 NATs, dhcp auto-configuration, and Google
// Compute Engine.
//
-// The config.Publisher mechanism is used for communicating networking
+// The pubsub.Publisher mechanism is used for communicating networking
// settings to the rpc.Server implementation of the runtime and publishes
// the Settings it expects.
package roaming
@@ -19,10 +19,10 @@
"v.io/x/lib/netconfig"
"v.io/x/lib/netstate"
+ "v.io/x/lib/pubsub"
"v.io/x/lib/vlog"
"v.io/v23"
- "v.io/v23/config"
"v.io/v23/context"
"v.io/v23/rpc"
@@ -86,11 +86,11 @@
}
}
- publisher := config.NewPublisher()
+ publisher := pubsub.NewPublisher()
// Create stream in Init function to avoid a race between any
// goroutines started here and consumers started after Init returns.
- ch := make(chan config.Setting)
+ ch := make(chan pubsub.Setting)
stop, err := publisher.CreateStream(SettingsStreamName, SettingsStreamName, ch)
if err != nil {
ac.Shutdown()
@@ -141,7 +141,7 @@
prev netstate.AddrList,
pubStop, cleanup <-chan struct{},
watcherLoop chan<- struct{},
- ch chan<- config.Setting) {
+ ch chan<- pubsub.Setting) {
defer close(ch)
listenSpec := runtime.GetListenSpec(ctx)