cloneOpt clones c.opt while holding optLock to prevent races with initConn which writes to MaintNotificationsConfig.Mode under the same lock.
()
| 359 | // cloneOpt clones c.opt while holding optLock to prevent races with initConn |
| 360 | // which writes to MaintNotificationsConfig.Mode under the same lock. |
| 361 | func (c *baseClient) cloneOpt() *Options { |
| 362 | c.optLock.RLock() |
| 363 | clone := c.opt.clone() |
| 364 | c.optLock.RUnlock() |
| 365 | return clone |
| 366 | } |
| 367 | |
| 368 | func (c *baseClient) withTimeout(timeout time.Duration) *baseClient { |
| 369 | opt := c.cloneOpt() |