chore: don't guard connection settings with the registry mutex (#32695)
This commit is contained in:
parent
136809f9b0
commit
232d367461
1 changed files with 9 additions and 9 deletions
|
|
@ -104,7 +104,7 @@ type meterConnection struct {
|
||||||
proto Protocol
|
proto Protocol
|
||||||
refs int // count of references; first connection has ref count 0
|
refs int // count of references; first connection has ref count 0
|
||||||
|
|
||||||
// largest value requested by any of the sharing logical connections
|
mu sync.Mutex
|
||||||
delay time.Duration
|
delay time.Duration
|
||||||
connectDelay time.Duration
|
connectDelay time.Duration
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
|
|
@ -114,23 +114,23 @@ type meterConnection struct {
|
||||||
|
|
||||||
// setDelay applies the delay if larger than the current value
|
// setDelay applies the delay if larger than the current value
|
||||||
func (c *meterConnection) setDelay(delay time.Duration) {
|
func (c *meterConnection) setDelay(delay time.Duration) {
|
||||||
mu.Lock()
|
c.mu.Lock()
|
||||||
defer mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
||||||
c.delay = max(c.delay, delay)
|
c.delay = max(c.delay, delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *meterConnection) getDelay() time.Duration {
|
func (c *meterConnection) getDelay() time.Duration {
|
||||||
mu.Lock()
|
c.mu.Lock()
|
||||||
defer mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
||||||
return c.delay
|
return c.delay
|
||||||
}
|
}
|
||||||
|
|
||||||
// setConnectDelay applies the connect delay if larger than the current value
|
// setConnectDelay applies the connect delay if larger than the current value
|
||||||
func (c *meterConnection) setConnectDelay(delay time.Duration) {
|
func (c *meterConnection) setConnectDelay(delay time.Duration) {
|
||||||
mu.Lock()
|
c.mu.Lock()
|
||||||
defer mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
||||||
if delay > c.connectDelay {
|
if delay > c.connectDelay {
|
||||||
c.connectDelay = delay
|
c.connectDelay = delay
|
||||||
|
|
@ -140,8 +140,8 @@ func (c *meterConnection) setConnectDelay(delay time.Duration) {
|
||||||
|
|
||||||
// setTimeout applies the timeout if larger than the current value
|
// setTimeout applies the timeout if larger than the current value
|
||||||
func (c *meterConnection) setTimeout(timeout time.Duration) {
|
func (c *meterConnection) setTimeout(timeout time.Duration) {
|
||||||
mu.Lock()
|
c.mu.Lock()
|
||||||
defer mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
||||||
if timeout > c.timeout {
|
if timeout > c.timeout {
|
||||||
c.timeout = timeout
|
c.timeout = timeout
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue