File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,10 @@ func CopyNetworks() []*Network {
9898// This type is only exported so that you can expose internal network state
9999// for debugging via CopyNetworks().
100100type Network struct {
101+ // mu covers all following fields.
102+ mu sync.Mutex
101103 servers []string
102104 idxOffset int
103- mu sync.RWMutex
104105 backoff map [string ]backoffState
105106}
106107
@@ -180,8 +181,8 @@ func newNetwork(networkname string) (*Network, error) {
180181// case back-off prevents us from connecting anywhere right now, the function
181182// blocks until back-off is over. Returns error on context cancellation.
182183func (n * Network ) server (ctx context.Context , random bool ) (string , error ) {
183- n .mu .RLock ()
184- defer n .mu .RUnlock ()
184+ n .mu .Lock ()
185+ defer n .mu .Unlock ()
185186
186187 for {
187188 soonest := time .Duration (math .MaxInt64 )
You can’t perform that action at this time.
0 commit comments