Skip to content

Commit

Permalink
add 2 getter for metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Jul 7, 2020
1 parent 61b6a3e commit 5d79d1b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,20 @@ func (s *UDPSession) GetRTO() uint32 {
return s.kcp.rx_rto
}

// GetSRTT gets current srtt of the session
func (s *UDPSession) GetSRTT() int32 {
s.mu.Lock()
defer s.mu.Unlock()
return s.kcp.rx_srtt
}

// GetRTTVar gets current rtt variance of the session
func (s *UDPSession) GetSRTTVar() int32 {
s.mu.Lock()
defer s.mu.Unlock()
return s.kcp.rx_rttvar
}

func (s *UDPSession) notifyReadEvent() {
select {
case s.chReadEvent <- struct{}{}:
Expand Down

0 comments on commit 5d79d1b

Please sign in to comment.