Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Commit suggestions.

Co-authored-by: Vinicius Fortuna <[email protected]>
  • Loading branch information
sbruens and fortuna authored Mar 26, 2024
1 parent 3eb0114 commit 714252f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/outline-ss-server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ func (c *tunnelTimeCollector) Describe(ch chan<- *prometheus.Desc) {
}

func (c *tunnelTimeCollector) Collect(ch chan<- prometheus.Metric) {
c.mu.Lock()
defer c.mu.Unlock()
tNow := now()
c.mu.Lock()
for ipKey, client := range c.activeClients {
c.reportTunnelTime(ipKey, client, tNow)
}
c.mu.Unlock()
c.tunnelTimePerKey.Collect(ch)
c.tunnelTimePerLocation.Collect(ch)
}
Expand All @@ -128,9 +128,9 @@ func (c *tunnelTimeCollector) startConnection(ipKey IPKey) {
if !exists {
clientInfo, _ := ipinfo.GetIPInfoFromIP(c.ip2info, net.IP(ipKey.ip.AsSlice()))
client = &activeClient{info: clientInfo, startTime: now()}
c.activeClients[ipKey] = client
}
client.connCount++
c.activeClients[ipKey] = client
}

// Removes an active connection for a client [net.Addr] and access key.
Expand Down

0 comments on commit 714252f

Please sign in to comment.