Background reconnects from monitorSocket() could cause a race between StatsClient.statSegment reassignment and statSegment virtual method calls, detectable by Golang race detector.
Now statSegment is protected by RwMutex and StatsClient is protected from spurious background reconnects after Disconnect() call.
Background reconnects from monitorSocket() could cause a race between StatsClient.statSegment reassignment and statSegment virtual method calls, detectable by Golang race detector. Now statSegment is protected by RwMutex and StatsClient is protected from spurious background reconnects after Disconnect() call.