@@ -106,9 +106,21 @@ func (s *Stream) SetReliabilityParams(unordered bool, relType byte, relVal uint3
106106func (s * Stream ) setReliabilityParams (unordered bool , relType byte , relVal uint32 ) {
107107 s .log .Debugf ("[%s] reliability params: ordered=%v type=%d value=%d" ,
108108 s .name , ! unordered , relType , relVal )
109+
109110 s .unordered = unordered
110- s .reliabilityType = relType
111- s .reliabilityValue = relVal
111+
112+ // RFC 7496 sec 3.1: 0 retransmissions is allowed
113+ // RFC 3758 sec 4.1: lifetime may be any value; 0 -> immediate expiry
114+ if relType == ReliabilityTypeRexmit || relType == ReliabilityTypeTimed {
115+ s .reliabilityType = ReliabilityTypeTimed
116+ s .reliabilityValue = relVal
117+
118+ return
119+ }
120+
121+ // for ReliabilityTypeReliable and unknown types, fall back to fully reliable
122+ s .reliabilityType = ReliabilityTypeReliable
123+ s .reliabilityValue = 0
112124}
113125
114126// Read reads a packet of len(p) bytes, dropping the Payload Protocol Identifier.
@@ -327,7 +339,7 @@ func (s *Stream) packetize(raw []byte, ppi PayloadProtocolIdentifier) ([]*chunkP
327339 offset := uint32 (0 )
328340 remaining := uint32 (len (raw )) //nolint:gosec // G115
329341
330- // From draft-ietf-rtcweb-data-protocol-09 , section 6:
342+ // From RFC 8832 , section 6:
331343 // All Data Channel Establishment Protocol messages MUST be sent using
332344 // ordered delivery and reliable transmission.
333345 unordered := ppi != PayloadTypeWebRTCDCEP && s .unordered
@@ -364,7 +376,7 @@ func (s *Stream) packetize(raw []byte, ppi PayloadProtocolIdentifier) ([]*chunkP
364376 offset += fragmentSize
365377 }
366378
367- // RFC 4960 Sec 6.6
379+ // RFC 9260 Sec 6.6
368380 // Note: When transmitting ordered and unordered data, an endpoint does
369381 // not increment its Stream Sequence Number when transmitting a DATA
370382 // chunk with U flag set to 1.
@@ -493,7 +505,7 @@ func (s *Stream) onInboundStreamReset() {
493505 // See RFC 8831 section 6.7:
494506 // if one side decides to close the data channel, it resets the corresponding
495507 // outgoing stream. When the peer sees that an incoming stream was
496- // reset, it also resets its corresponding outgoing stream. Once this
508+ // reset, it also resets its corresponding outgoing stream. Once this
497509 // is completed, the data channel is closed.
498510
499511 s .readErr = io .EOF
0 commit comments