Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Bytes/Messages Sent/Received public on data channels #2766

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading