mirror of
https://github.com/codecat/go-enet.git
synced 2025-12-08 05:59:47 +00:00
expose rtt
This commit is contained in:
parent
1c03ac96b7
commit
55084b9fa8
1 changed files with 33 additions and 0 deletions
33
peer.go
33
peer.go
|
|
@ -40,6 +40,14 @@ type Peer interface {
|
||||||
//
|
//
|
||||||
// http://enet.bespin.org/structENetPeer.html#a1873959810db7ac7a02da90469ee384e
|
// http://enet.bespin.org/structENetPeer.html#a1873959810db7ac7a02da90469ee384e
|
||||||
GetData() []byte
|
GetData() []byte
|
||||||
|
|
||||||
|
//rtt
|
||||||
|
GetRoundTripTime() uint32
|
||||||
|
GetLastRoundTripTime() uint32
|
||||||
|
GetLowestRoundTripTime() uint32
|
||||||
|
GetRoundTripTimeVariance() uint32
|
||||||
|
GetLastRoundTripTimeVariance() uint32
|
||||||
|
GetHighestRoundTripTimeVariance() uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type enetPeer struct {
|
type enetPeer struct {
|
||||||
|
|
@ -151,3 +159,28 @@ func (peer enetPeer) GetData() []byte {
|
||||||
C.int(binary.LittleEndian.Uint32(header)),
|
C.int(binary.LittleEndian.Uint32(header)),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rtt impl
|
||||||
|
func (peer enetPeer) GetRoundTripTime() uint32 {
|
||||||
|
return uint32(peer.cPeer.roundTripTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (peer enetPeer) GetLastRoundTripTime() uint32 {
|
||||||
|
return uint32(peer.cPeer.lastRoundTripTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (peer enetPeer) GetLowestRoundTripTime() uint32 {
|
||||||
|
return uint32(peer.cPeer.lowestRoundTripTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (peer enetPeer) GetRoundTripTimeVariance() uint32 {
|
||||||
|
return uint32(peer.cPeer.roundTripTimeVariance)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (peer enetPeer) GetLastRoundTripTimeVariance() uint32 {
|
||||||
|
return uint32(peer.cPeer.lastRoundTripTimeVariance)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (peer enetPeer) GetHighestRoundTripTimeVariance() uint32 {
|
||||||
|
return uint32(peer.cPeer.highestRoundTripTimeVariance)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue