2020-05-01 05:47:46 +00:00
|
|
|
package api
|
2017-03-20 00:04:47 +00:00
|
|
|
|
|
|
|
//ConnectionStats --
|
|
|
|
type ConnectionStats struct {
|
2017-03-23 23:10:49 +00:00
|
|
|
Connections int64
|
|
|
|
TotalConnections int64
|
2017-03-20 00:04:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//NewConnectionStats -- Consttuctor
|
|
|
|
func NewConnectionStats() (p *ConnectionStats) {
|
|
|
|
p = new(ConnectionStats)
|
|
|
|
p.Connections = 0
|
2017-03-23 23:10:49 +00:00
|
|
|
p.TotalConnections = 0
|
2017-03-20 00:04:47 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
//IncConnections --
|
|
|
|
func (p *ConnectionStats) IncConnections() {
|
|
|
|
p.Connections++
|
2017-03-23 23:10:49 +00:00
|
|
|
p.TotalConnections++
|
2017-03-20 00:04:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//DecConnections --
|
|
|
|
func (p *ConnectionStats) DecConnections() {
|
2017-03-23 23:10:49 +00:00
|
|
|
if p.Connections > 0 {
|
|
|
|
p.Connections--
|
|
|
|
}
|
2017-03-20 00:04:47 +00:00
|
|
|
}
|