mirror of
https://github.com/pion/webrtc.git
synced 2025-09-26 19:21:12 +08:00
Added SCTPTransport.BufferedAmount
It simplifies tracking amount of unsent data for all data channels, including ones in closing state. Especially useful for IoT apps which use multiple data channels and have to monitor memory usage.
This commit is contained in:
@@ -430,3 +430,14 @@ func (r *SCTPTransport) association() *sctp.Association {
|
||||
|
||||
return association
|
||||
}
|
||||
|
||||
// BufferedAmount returns total amount (in bytes) of currently buffered user data.
|
||||
func (r *SCTPTransport) BufferedAmount() int {
|
||||
r.lock.Lock()
|
||||
defer r.lock.Unlock()
|
||||
if r.sctpAssociation == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return r.sctpAssociation.BufferedAmount()
|
||||
}
|
||||
|
Reference in New Issue
Block a user