Skip to content

Commit

Permalink
Make Bytes/Messages Sent/Received public
Browse files Browse the repository at this point in the history
  • Loading branch information
danjenkins committed May 8, 2024
1 parent aa9c623 commit ae18317
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions datachannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,38 @@ func (d *DataChannel) BufferedAmountLowThreshold() uint64 {
return d.dataChannel.BufferedAmountLowThreshold()
}

// BytesReceived returns the number of bytes received
func (d *DataChannel) BytesReceived() uint64 {
d.mu.Lock()
defer d.mu.Unlock()

return d.dataChannel.BytesReceived()
}

// BytesSent returns the number of bytes sent
func (d *DataChannel) BytesSent() uint64 {
d.mu.Lock()
defer d.mu.Unlock()

return d.dataChannel.BytesSent()
}

// MessagesSent returns the number of messages sent
func (d *DataChannel) MessagesSent() uint32 {
d.mu.Lock()
defer d.mu.Unlock()

return d.dataChannel.MessagesSent()
}

// MessagesReceived returns the number of messages received
func (d *DataChannel) MessagesReceived() uint32 {
d.mu.Lock()
defer d.mu.Unlock()

return d.dataChannel.MessagesReceived()
}

// SetBufferedAmountLowThreshold is used to update the threshold.
// See BufferedAmountLowThreshold().
func (d *DataChannel) SetBufferedAmountLowThreshold(th uint64) {
Expand Down

0 comments on commit ae18317

Please sign in to comment.