RPC: Initialize lastUsedTime to after the conn has been initialized.
This prevents it from seeming idle as soon as it has been created.
Change-Id: If2d6be8e9fbbedd5234de43159c5377629c528be
diff --git a/runtime/internal/flow/conn/conn.go b/runtime/internal/flow/conn/conn.go
index 29b833a..b8723a6 100644
--- a/runtime/internal/flow/conn/conn.go
+++ b/runtime/internal/flow/conn/conn.go
@@ -228,6 +228,10 @@
}
c.loopWG.Add(1)
go c.readLoop(ctx)
+
+ c.mu.Lock()
+ c.lastUsedTime = time.Now()
+ c.mu.Unlock()
return c, names, rejected, nil
}
@@ -297,6 +301,9 @@
c.loopWG.Add(2)
go c.blessingsLoop(ctx, refreshTime, lAuthorizedPeers)
go c.readLoop(ctx)
+ c.mu.Lock()
+ c.lastUsedTime = time.Now()
+ c.mu.Unlock()
return c, nil
}