flow/conn: Make markUsed only update user created flows.
Change-Id: If6c597d388950bc224f3e0bc85e6a574fdc89fcc
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()
+ }
+}