veyron/profiles/roaming: minor tweaks to get roaming working.
Change-Id: Ia64b90e3ddca6ef8c88530f980082f07c1f06d19
diff --git a/profiles/gce/init.go b/profiles/gce/init.go
index f908d48..225de2c 100644
--- a/profiles/gce/init.go
+++ b/profiles/gce/init.go
@@ -5,25 +5,32 @@
package gce
import (
+ "flag"
"fmt"
"net"
- "veyron.io/veyron/veyron/profiles"
-
"veyron.io/veyron/veyron2"
"veyron.io/veyron/veyron2/config"
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/rt"
+ "veyron.io/veyron/veyron/lib/flags"
+ "veyron.io/veyron/veyron/profiles"
"veyron.io/veyron/veyron/profiles/internal/gce"
)
-var ListenSpec = &ipc.ListenSpec{
- Protocol: "tcp",
- Address: "127.0.0.1:0",
-}
+var (
+ listenAddressFlag = flags.IPHostPortFlag{Port: "0"}
+
+ ListenSpec = &ipc.ListenSpec{
+ Protocol: "tcp",
+ Address: "127.0.0.1:0",
+ }
+)
func init() {
+ flag.Var(&listenAddressFlag, "veyron.tcp.address", "address to listen on")
+
rt.RegisterProfile(&profile{})
}
@@ -50,6 +57,7 @@
if !gce.RunningOnGCE() {
return fmt.Errorf("GCE profile used on a non-GCE system")
}
+ ListenSpec.Address = listenAddressFlag.String()
if ip, err := gce.ExternalIPAddress(); err != nil {
return err
} else {
diff --git a/profiles/roaming/init.go b/profiles/roaming/init.go
index feffb24..e78dc3c 100644
--- a/profiles/roaming/init.go
+++ b/profiles/roaming/init.go
@@ -73,7 +73,7 @@
}
func (p *profile) Name() string {
- return "dhcp" + p.gce
+ return "roaming" + p.gce
}
func (p *profile) Runtime() string {
diff --git a/runtimes/google/ipc/server.go b/runtimes/google/ipc/server.go
index 0f33be4..fff0337 100644
--- a/runtimes/google/ipc/server.go
+++ b/runtimes/google/ipc/server.go
@@ -272,13 +272,13 @@
return nil, err
}
ep, ipaddr, err := s.externalEndpoint(listenSpec.AddressChooser, lep)
- if ipaddr == nil || err != nil {
+ if err != nil {
ln.Close()
- if ipaddr == nil {
- return nil, fmt.Errorf("the address %q requested for listening contained a fixed IP address which disables roaming, use :0 instead", address)
- }
return nil, err
}
+ if ipaddr == nil {
+ vlog.VI(2).Infof("the address %q requested for listening contained a fixed IP address which disables roaming, use :0 instead", address)
+ }
s.Lock()
if s.stopped {