Skip to content

Commit

Permalink
Max recv buf size via SettingEngine
Browse files Browse the repository at this point in the history
Relates to pion/sctp#218
  • Loading branch information
enobufs authored and daonb committed Nov 20, 2022
1 parent 814eebf commit 8590383
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sctptransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ func (r *SCTPTransport) Start(remoteCaps SCTPCapabilities) error {
}

sctpAssociation, err := sctp.Client(sctp.Config{
NetConn: dtlsTransport.conn,
LoggerFactory: r.api.settingEngine.LoggerFactory,
NetConn: dtlsTransport.conn,
MaxReceiveBufferSize: r.api.settingEngine.sctp.maxReceiveBufferSize,
LoggerFactory: r.api.settingEngine.LoggerFactory,
})
if err != nil {
return err
Expand Down
9 changes: 9 additions & 0 deletions settingengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type SettingEngine struct {
dtls struct {
retransmissionInterval time.Duration
}
sctp struct {
maxReceiveBufferSize uint32
}
sdpMediaLevelFingerprints bool
answeringDTLSRole DTLSRole
disableCertificateFingerprintVerification bool
Expand Down Expand Up @@ -304,3 +307,9 @@ func (e *SettingEngine) SetReceiveMTU(receiveMTU uint) {
func (e *SettingEngine) SetDTLSRetransmissionInterval(interval time.Duration) {
e.dtls.retransmissionInterval = interval
}

// SetSCTPMaxReceiveBufferSize sets the maximum receive buffer size.
// Leave this 0 for the default maxReceiveBufferSize.
func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {
e.sctp.maxReceiveBufferSize = maxReceiveBufferSize
}

0 comments on commit 8590383

Please sign in to comment.