diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-02-07 00:02:00 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-02-07 00:02:00 +0000 |
commit | 2c63b17ff9c2ab72452052a4a6f49b05291da61f (patch) | |
tree | e241bf5bc1ed5f372f4bd569220b5d3cfd3623fb /pkg/tcpip/tcpip.go | |
parent | cd527c63ecc2cad7513aeab78fe68de32dd77c12 (diff) | |
parent | 940d255971c38af9f91ceed1345fd973f8fdb41d (diff) |
Merge release-20200127.0-92-g940d255 (automated)
Diffstat (limited to 'pkg/tcpip/tcpip.go')
-rw-r--r-- | pkg/tcpip/tcpip.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go index d29d9a704..0e944712f 100644 --- a/pkg/tcpip/tcpip.go +++ b/pkg/tcpip/tcpip.go @@ -1170,7 +1170,9 @@ type TransportEndpointStats struct { // marker interface. func (*TransportEndpointStats) IsEndpointStats() {} -func fillIn(v reflect.Value) { +// InitStatCounters initializes v's fields with nil StatCounter fields to new +// StatCounters. +func InitStatCounters(v reflect.Value) { for i := 0; i < v.NumField(); i++ { v := v.Field(i) if s, ok := v.Addr().Interface().(**StatCounter); ok { @@ -1178,14 +1180,14 @@ func fillIn(v reflect.Value) { *s = new(StatCounter) } } else { - fillIn(v) + InitStatCounters(v) } } } // FillIn returns a copy of s with nil fields initialized to new StatCounters. func (s Stats) FillIn() Stats { - fillIn(reflect.ValueOf(&s).Elem()) + InitStatCounters(reflect.ValueOf(&s).Elem()) return s } |