mirror of
https://github.com/pion/webrtc.git
synced 2025-10-06 15:46:54 +08:00
Add SetDTLSConnectionState
Allow a DTLS Connection to be resumed from DTLS ConnectionState
This commit is contained in:
@@ -330,7 +330,9 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error {
|
|||||||
|
|
||||||
// Connect as DTLS Client/Server, function is blocking and we
|
// Connect as DTLS Client/Server, function is blocking and we
|
||||||
// must not hold the DTLSTransport lock
|
// must not hold the DTLSTransport lock
|
||||||
if role == DTLSRoleClient {
|
if t.api.settingEngine.dtls.connectionState != nil {
|
||||||
|
dtlsConn, err = dtls.Resume(t.api.settingEngine.dtls.connectionState, dtlsEndpoint, dtlsConfig)
|
||||||
|
} else if role == DTLSRoleClient {
|
||||||
dtlsConn, err = dtls.Client(dtlsEndpoint, dtlsConfig)
|
dtlsConn, err = dtls.Client(dtlsEndpoint, dtlsConfig)
|
||||||
} else {
|
} else {
|
||||||
dtlsConn, err = dtls.Server(dtlsEndpoint, dtlsConfig)
|
dtlsConn, err = dtls.Server(dtlsEndpoint, dtlsConfig)
|
||||||
|
@@ -60,6 +60,7 @@ type SettingEngine struct {
|
|||||||
insecureSkipHelloVerify bool
|
insecureSkipHelloVerify bool
|
||||||
retransmissionInterval time.Duration
|
retransmissionInterval time.Duration
|
||||||
ellipticCurves []dtlsElliptic.Curve
|
ellipticCurves []dtlsElliptic.Curve
|
||||||
|
connectionState *dtls.State
|
||||||
}
|
}
|
||||||
sctp struct {
|
sctp struct {
|
||||||
maxReceiveBufferSize uint32
|
maxReceiveBufferSize uint32
|
||||||
@@ -370,3 +371,7 @@ func (e *SettingEngine) SetDTLSEllipticCurves(ellipticCurves ...dtlsElliptic.Cur
|
|||||||
func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {
|
func (e *SettingEngine) SetSCTPMaxReceiveBufferSize(maxReceiveBufferSize uint32) {
|
||||||
e.sctp.maxReceiveBufferSize = maxReceiveBufferSize
|
e.sctp.maxReceiveBufferSize = maxReceiveBufferSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *SettingEngine) SetDTLSConnectionState(connectionState *dtls.State) {
|
||||||
|
e.dtls.connectionState = connectionState
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user