mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Fix minor data race in Snowflake broker metrics
This commit is contained in:
parent
1180d11a66
commit
63613cc50a
1 changed files with 2 additions and 0 deletions
|
@ -214,7 +214,9 @@ func (i *IPC) ClientOffers(arg messages.Arg, response *[]byte) error {
|
||||||
resp := &messages.ClientPollResponse{Answer: answer}
|
resp := &messages.ClientPollResponse{Answer: answer}
|
||||||
err = sendClientResponse(resp, response)
|
err = sendClientResponse(resp, response)
|
||||||
// Initial tracking of elapsed time.
|
// Initial tracking of elapsed time.
|
||||||
|
i.ctx.metrics.lock.Lock()
|
||||||
i.ctx.metrics.clientRoundtripEstimate = time.Since(startTime) / time.Millisecond
|
i.ctx.metrics.clientRoundtripEstimate = time.Since(startTime) / time.Millisecond
|
||||||
|
i.ctx.metrics.lock.Unlock()
|
||||||
case <-time.After(time.Second * ClientTimeout):
|
case <-time.After(time.Second * ClientTimeout):
|
||||||
log.Println("Client: Timed out.")
|
log.Println("Client: Timed out.")
|
||||||
resp := &messages.ClientPollResponse{Error: messages.StrTimedOut}
|
resp := &messages.ClientPollResponse{Error: messages.StrTimedOut}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue