Skip to content

Commit

Permalink
Fix ConnGauge nil crash
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyxdd committed Apr 28, 2021
1 parent ac1233a commit 214f1cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/core/server_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ func (c *serverClient) Run() {
if err != nil {
break
}
c.ConnGauge.Inc()
if c.ConnGauge != nil {
c.ConnGauge.Inc()
}
go func() {
c.handleStream(stream)
_ = stream.Close()
c.ConnGauge.Dec()
if c.ConnGauge != nil {
c.ConnGauge.Dec()
}
}()
}
}
Expand Down

0 comments on commit 214f1cf

Please sign in to comment.