Merge "flow,xproxyd: Bump up leakWaitTime to 250ms."
diff --git a/runtime/internal/flow/conn/flow.go b/runtime/internal/flow/conn/flow.go
index dd6ffc6..3bfd000 100644
--- a/runtime/internal/flow/conn/flow.go
+++ b/runtime/internal/flow/conn/flow.go
@@ -56,7 +56,7 @@
// Read and ReadMsg should not be called concurrently with themselves
// or each other.
func (f *flw) Read(p []byte) (n int, err error) {
- f.conn.markUsed()
+ f.markUsed()
if n, err = f.q.read(f.ctx, p); err != nil {
f.close(f.ctx, err)
}
@@ -68,7 +68,7 @@
// Read and ReadMsg should not be called concurrently with themselves
// or each other.
func (f *flw) ReadMsg() (buf []byte, err error) {
- f.conn.markUsed()
+ f.markUsed()
// TODO(mattr): Currently we only ever release counters when some flow
// reads. We may need to do it more or less often. Currently
// we'll send counters whenever a new flow is opened.
@@ -86,7 +86,7 @@
}
func (f *flw) writeMsg(alsoClose bool, parts ...[]byte) (int, error) {
- f.conn.markUsed()
+ f.markUsed()
sent := 0
var left []byte
err := f.worker.Run(f.ctx, func(tokens int) (int, bool, error) {
@@ -285,3 +285,9 @@
f.close(f.ctx, nil)
return nil
}
+
+func (f *flw) markUsed() {
+ if f.id >= reservedFlows {
+ f.conn.markUsed()
+ }
+}
diff --git a/runtime/internal/rpc/xserver.go b/runtime/internal/rpc/xserver.go
index 10ed8a0..e5c7f6f 100644
--- a/runtime/internal/rpc/xserver.go
+++ b/runtime/internal/rpc/xserver.go
@@ -243,10 +243,16 @@
s.Lock()
defer s.Unlock()
var lastErr error
+ var ep string
if len(listenSpec.Proxy) > 0 {
- lastErr = s.flowMgr.Listen(ctx, inaming.Network, listenSpec.Proxy)
+ ep, lastErr = s.resolveToEndpoint(listenSpec.Proxy)
if lastErr != nil {
- s.ctx.VI(2).Infof("Listen(%q, %q, ...) failed: %v", inaming.Network, listenSpec.Proxy, lastErr)
+ s.ctx.VI(2).Infof("resolveToEndpoint(%q) failed: %v", listenSpec.Proxy, lastErr)
+ } else {
+ lastErr = s.flowMgr.Listen(ctx, inaming.Network, ep)
+ if lastErr != nil {
+ s.ctx.VI(2).Infof("Listen(%q, %q, ...) failed: %v", inaming.Network, ep, lastErr)
+ }
}
}
for _, addr := range listenSpec.Addrs {