add 2 getter for metrics

This commit is contained in:
xtaci
2020-07-07 16:49:41 +08:00
parent 61b6a3efc7
commit 5d79d1b91b
+14
View File
@@ -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{}{}: