werift 0.17.6 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/src/binary.d.ts +1 -0
- package/lib/common/src/binary.js +74 -21
- package/lib/common/src/binary.js.map +1 -1
- package/lib/common/src/log.js +18 -0
- package/lib/common/src/log.js.map +1 -1
- package/lib/common/src/network.d.ts +1 -1
- package/lib/common/src/network.js +1 -0
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/promise.js +22 -7
- package/lib/common/src/promise.js.map +1 -1
- package/lib/common/src/type.d.ts +1 -1
- package/lib/dtls/src/cipher/const.d.ts +7 -7
- package/lib/dtls/src/cipher/key-exchange.js +24 -1
- package/lib/dtls/src/cipher/key-exchange.js.map +1 -1
- package/lib/dtls/src/cipher/suites/abstract.d.ts +2 -2
- package/lib/dtls/src/cipher/suites/abstract.js +36 -2
- package/lib/dtls/src/cipher/suites/abstract.js.map +1 -1
- package/lib/dtls/src/cipher/suites/aead.js +60 -6
- package/lib/dtls/src/cipher/suites/aead.js.map +1 -1
- package/lib/dtls/src/client.js +62 -51
- package/lib/dtls/src/client.js.map +1 -1
- package/lib/dtls/src/context/cipher.js +151 -59
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/dtls.js +90 -14
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/srtp.d.ts +1 -1
- package/lib/dtls/src/context/srtp.js +8 -0
- package/lib/dtls/src/context/srtp.js.map +1 -1
- package/lib/dtls/src/context/transport.js +14 -2
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight1.js +6 -1
- package/lib/dtls/src/flight/client/flight1.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +12 -2
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +1 -1
- package/lib/dtls/src/flight/flight.js +42 -7
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight2.js +4 -2
- package/lib/dtls/src/flight/server/flight2.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.js +12 -2
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js +6 -1
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/ellipticCurves.js +27 -7
- package/lib/dtls/src/handshake/extensions/ellipticCurves.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/extendedMasterSecret.js +6 -1
- package/lib/dtls/src/handshake/extensions/extendedMasterSecret.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/renegotiationIndication.js +27 -7
- package/lib/dtls/src/handshake/extensions/renegotiationIndication.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/signature.js +27 -7
- package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/useSrtp.js +39 -9
- package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
- package/lib/dtls/src/handshake/message/alert.js +21 -6
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +26 -5
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +14 -4
- package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js +33 -7
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js +68 -18
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +26 -5
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/finished.js +18 -2
- package/lib/dtls/src/handshake/message/finished.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.js +40 -9
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.js +60 -14
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js +18 -2
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +33 -7
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.js +75 -19
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.js +21 -6
- package/lib/dtls/src/handshake/random.js.map +1 -1
- package/lib/dtls/src/record/builder.d.ts +1 -1
- package/lib/dtls/src/record/message/fragment.js +49 -14
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.js +84 -24
- package/lib/dtls/src/record/message/header.js.map +1 -1
- package/lib/dtls/src/record/message/plaintext.js +21 -6
- package/lib/dtls/src/record/message/plaintext.js.map +1 -1
- package/lib/dtls/src/server.js +59 -42
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.js +153 -64
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/dtls/src/transport.js +38 -11
- package/lib/dtls/src/transport.js.map +1 -1
- package/lib/dtls/src/typings/domain.d.ts +4 -4
- package/lib/ice/src/candidate.js +66 -11
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/dns/lookup.js +12 -1
- package/lib/ice/src/dns/lookup.js.map +1 -1
- package/lib/ice/src/exceptions.js +27 -2
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/helper.d.ts +1 -1
- package/lib/ice/src/helper.js +12 -2
- package/lib/ice/src/helper.js.map +1 -1
- package/lib/ice/src/ice.d.ts +9 -3
- package/lib/ice/src/ice.js +407 -155
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/stun/attributes.d.ts +3 -3
- package/lib/ice/src/stun/attributes.js +6 -1
- package/lib/ice/src/stun/attributes.js.map +1 -1
- package/lib/ice/src/stun/message.d.ts +4 -0
- package/lib/ice/src/stun/message.js +24 -3
- package/lib/ice/src/stun/message.js.map +1 -1
- package/lib/ice/src/stun/protocol.js +64 -15
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.js +99 -36
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/transport.js +57 -21
- package/lib/ice/src/transport.js.map +1 -1
- package/lib/ice/src/turn/protocol.js +176 -40
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +1 -1
- package/lib/rtp/src/codec/av1.d.ts +1 -1
- package/lib/rtp/src/codec/av1.js +118 -30
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/base.js +8 -0
- package/lib/rtp/src/codec/base.js.map +1 -1
- package/lib/rtp/src/codec/h264.js +55 -0
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/index.d.ts +2 -0
- package/lib/rtp/src/codec/index.js +12 -2
- package/lib/rtp/src/codec/index.js.map +1 -1
- package/lib/rtp/src/codec/opus.js +8 -0
- package/lib/rtp/src/codec/opus.js.map +1 -1
- package/lib/rtp/src/codec/vp8.js +102 -3
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.js +164 -7
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/container/ebml/ebml.js +30 -3
- package/lib/rtp/src/container/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/container/webm.d.ts +1 -1
- package/lib/rtp/src/container/webm.js +44 -13
- package/lib/rtp/src/container/webm.js.map +1 -1
- package/lib/rtp/src/processor/depacketizer.d.ts +16 -8
- package/lib/rtp/src/processor/depacketizer.js +59 -22
- package/lib/rtp/src/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/processor/depacketizerCallback.js +24 -8
- package/lib/rtp/src/processor/depacketizerCallback.js.map +1 -1
- package/lib/rtp/src/processor/depacketizerTransformer.d.ts +2 -2
- package/lib/rtp/src/processor/depacketizerTransformer.js +6 -0
- package/lib/rtp/src/processor/depacketizerTransformer.js.map +1 -1
- package/lib/rtp/src/processor/index.d.ts +4 -2
- package/lib/rtp/src/processor/index.js +4 -2
- package/lib/rtp/src/processor/index.js.map +1 -1
- package/lib/rtp/src/processor/interface.d.ts +4 -0
- package/lib/rtp/src/processor/interface.js.map +1 -1
- package/lib/rtp/src/processor/jitterBuffer.d.ts +2 -1
- package/lib/rtp/src/processor/jitterBuffer.js +40 -8
- package/lib/rtp/src/processor/jitterBuffer.js.map +1 -1
- package/lib/rtp/src/processor/jitterBufferCallback.js +30 -9
- package/lib/rtp/src/processor/jitterBufferCallback.js.map +1 -1
- package/lib/rtp/src/processor/jitterBufferTransformer.js +12 -1
- package/lib/rtp/src/processor/jitterBufferTransformer.js.map +1 -1
- package/lib/rtp/src/processor/lipsync.d.ts +42 -0
- package/lib/rtp/src/processor/lipsync.js +178 -0
- package/lib/rtp/src/processor/lipsync.js.map +1 -0
- package/lib/rtp/src/processor/lipsyncCallback.d.ts +10 -0
- package/lib/rtp/src/processor/lipsyncCallback.js +59 -0
- package/lib/rtp/src/processor/lipsyncCallback.js.map +1 -0
- package/lib/rtp/src/processor/ntpTime.d.ts +24 -0
- package/lib/rtp/src/processor/ntpTime.js +91 -0
- package/lib/rtp/src/processor/ntpTime.js.map +1 -0
- package/lib/rtp/src/processor/ntpTimeCallback.d.ts +7 -0
- package/lib/rtp/src/processor/ntpTimeCallback.js +36 -0
- package/lib/rtp/src/processor/ntpTimeCallback.js.map +1 -0
- package/lib/rtp/src/processor/source/index.d.ts +1 -0
- package/lib/rtp/src/processor/source/index.js +1 -0
- package/lib/rtp/src/processor/source/index.js.map +1 -1
- package/lib/rtp/src/processor/source/rtcpCallback.d.ts +12 -0
- package/lib/rtp/src/processor/source/rtcpCallback.js +33 -0
- package/lib/rtp/src/processor/source/rtcpCallback.js.map +1 -0
- package/lib/rtp/src/processor/source/rtpCallback.js +28 -12
- package/lib/rtp/src/processor/source/rtpCallback.js.map +1 -1
- package/lib/rtp/src/processor/source/rtpStream.js +38 -10
- package/lib/rtp/src/processor/source/rtpStream.js.map +1 -1
- package/lib/rtp/src/processor/webm.d.ts +11 -4
- package/lib/rtp/src/processor/webm.js +169 -46
- package/lib/rtp/src/processor/webm.js.map +1 -1
- package/lib/rtp/src/processor/webmCallback.d.ts +5 -3
- package/lib/rtp/src/processor/webmCallback.js +52 -8
- package/lib/rtp/src/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/processor/webmStream.d.ts +2 -2
- package/lib/rtp/src/processor/webmStream.js +24 -0
- package/lib/rtp/src/processor/webmStream.js.map +1 -1
- package/lib/rtp/src/processor_old/base.d.ts +18 -0
- package/lib/rtp/src/processor_old/base.js +51 -0
- package/lib/rtp/src/processor_old/base.js.map +1 -0
- package/lib/rtp/src/processor_old/lipsync.d.ts +30 -0
- package/lib/rtp/src/processor_old/lipsync.js +119 -0
- package/lib/rtp/src/processor_old/lipsync.js.map +1 -0
- package/lib/rtp/src/rtcp/header.js +30 -5
- package/lib/rtp/src/rtcp/header.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +30 -3
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/index.d.ts +1 -1
- package/lib/rtp/src/rtcp/psfb/index.js +18 -2
- package/lib/rtp/src/rtcp/psfb/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/pictureLossIndication.js +30 -3
- package/lib/rtp/src/rtcp/psfb/pictureLossIndication.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/remb.js +66 -5
- package/lib/rtp/src/rtcp/psfb/remb.js.map +1 -1
- package/lib/rtp/src/rtcp/rr.js +68 -4
- package/lib/rtp/src/rtcp/rr.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.d.ts +1 -1
- package/lib/rtp/src/rtcp/rtpfb/index.d.ts +1 -1
- package/lib/rtp/src/rtcp/rtpfb/index.js +24 -2
- package/lib/rtp/src/rtcp/rtpfb/index.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/nack.d.ts +5 -0
- package/lib/rtp/src/rtcp/rtpfb/nack.js +43 -3
- package/lib/rtp/src/rtcp/rtpfb/nack.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/twcc.js +154 -11
- package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
- package/lib/rtp/src/rtcp/sdes.js +42 -4
- package/lib/rtp/src/rtcp/sdes.js.map +1 -1
- package/lib/rtp/src/rtcp/sr.js +56 -5
- package/lib/rtp/src/rtcp/sr.js.map +1 -1
- package/lib/rtp/src/rtp/red/encoder.js +18 -3
- package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
- package/lib/rtp/src/rtp/red/handler.js +12 -2
- package/lib/rtp/src/rtp/red/handler.js.map +1 -1
- package/lib/rtp/src/rtp/red/packet.js +18 -2
- package/lib/rtp/src/rtp/red/packet.js.map +1 -1
- package/lib/rtp/src/rtp/rtp.d.ts +3 -3
- package/lib/rtp/src/rtp/rtp.js +104 -17
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.js +26 -10
- package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.d.ts +3 -0
- package/lib/rtp/src/srtp/cipher/gcm.js +40 -20
- package/lib/rtp/src/srtp/cipher/gcm.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/index.js +24 -4
- package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
- package/lib/rtp/src/srtp/const.d.ts +1 -1
- package/lib/rtp/src/srtp/context/context.d.ts +1 -1
- package/lib/rtp/src/srtp/context/context.js +84 -5
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/session.d.ts +2 -2
- package/lib/rtp/src/srtp/session.js +24 -1
- package/lib/rtp/src/srtp/session.js.map +1 -1
- package/lib/rtp/src/srtp/srtcp.js +15 -5
- package/lib/rtp/src/srtp/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/srtp.js +15 -5
- package/lib/rtp/src/srtp/srtp.js.map +1 -1
- package/lib/sctp/src/chunk.js +349 -69
- package/lib/sctp/src/chunk.js.map +1 -1
- package/lib/sctp/src/helper.d.ts +1 -1
- package/lib/sctp/src/param.d.ts +3 -3
- package/lib/sctp/src/param.js +66 -11
- package/lib/sctp/src/param.js.map +1 -1
- package/lib/sctp/src/sctp.d.ts +1 -1
- package/lib/sctp/src/sctp.js +479 -138
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/sctp/src/transport.js +31 -10
- package/lib/sctp/src/transport.js.map +1 -1
- package/lib/webrtc/src/dataChannel.d.ts +1 -1
- package/lib/webrtc/src/dataChannel.js +145 -15
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/helper.js +37 -12
- package/lib/webrtc/src/helper.js.map +1 -1
- package/lib/webrtc/src/media/parameters.d.ts +1 -1
- package/lib/webrtc/src/media/parameters.js +124 -3
- package/lib/webrtc/src/media/parameters.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.d.ts +4 -4
- package/lib/webrtc/src/media/receiver/nack.js +85 -33
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js +42 -6
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/receiver/statistics.js +61 -5
- package/lib/webrtc/src/media/receiver/statistics.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +1 -1
- package/lib/webrtc/src/media/router.js +108 -83
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.js +188 -33
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.js +279 -42
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +2 -2
- package/lib/webrtc/src/media/rtpTransceiver.js +102 -18
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/cumulativeResult.js +36 -6
- package/lib/webrtc/src/media/sender/cumulativeResult.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.js +57 -12
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/track.js +135 -24
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +7 -4
- package/lib/webrtc/src/nonstandard/recorder/index.js +50 -6
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js +12 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +39 -35
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.js +158 -56
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +2 -2
- package/lib/webrtc/src/peerConnection.js +260 -58
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/sdp.js +287 -24
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +3 -3
- package/lib/webrtc/src/transport/dtls.js +185 -30
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +2 -2
- package/lib/webrtc/src/transport/ice.js +193 -25
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.js +193 -101
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/types/domain.d.ts +3 -3
- package/lib/webrtc/src/types/util.d.ts +2 -2
- package/lib/webrtc/src/utils.js +12 -2
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +15 -15
- package/src/dataChannel.ts +3 -1
- package/src/media/receiver/nack.ts +23 -19
- package/src/media/rtpReceiver.ts +5 -0
- package/src/media/rtpSender.ts +22 -19
- package/src/nonstandard/recorder/index.ts +12 -4
- package/src/nonstandard/recorder/writer/webm.ts +42 -50
- package/src/transport/dtls.ts +7 -3
- package/src/transport/ice.ts +6 -3
- package/src/transport/sctp.ts +3 -1
- package/lib/rtp/src/processor/avBuffer.d.ts +0 -36
- package/lib/rtp/src/processor/avBuffer.js +0 -107
- package/lib/rtp/src/processor/avBuffer.js.map +0 -1
- package/lib/rtp/src/processor/avBufferCallback.d.ts +0 -10
- package/lib/rtp/src/processor/avBufferCallback.js +0 -27
- package/lib/rtp/src/processor/avBufferCallback.js.map +0 -1
package/lib/sctp/src/sctp.js
CHANGED
|
@@ -46,160 +46,486 @@ const SCTPConnectionStates = [
|
|
|
46
46
|
];
|
|
47
47
|
class SCTP {
|
|
48
48
|
constructor(transport, port = 5000) {
|
|
49
|
-
this
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
Object.defineProperty(this, "transport", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: transport
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "port", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: port
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(this, "stateChanged", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
value: (0, helper_1.createEventsFromList)(SCTPConnectionStates)
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(this, "onReconfigStreams", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: new rx_mini_1.Event()
|
|
72
|
+
});
|
|
53
73
|
/**streamId: number, ppId: number, data: Buffer */
|
|
54
|
-
this
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this
|
|
74
|
+
Object.defineProperty(this, "onReceive", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
configurable: true,
|
|
77
|
+
writable: true,
|
|
78
|
+
value: new rx_mini_1.Event()
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(this, "onSackReceived", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
configurable: true,
|
|
83
|
+
writable: true,
|
|
84
|
+
value: async () => { }
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(this, "associationState", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true,
|
|
90
|
+
value: const_1.SCTP_STATE.CLOSED
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(this, "started", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true,
|
|
95
|
+
writable: true,
|
|
96
|
+
value: false
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(this, "state", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
value: "new"
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(this, "isServer", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
configurable: true,
|
|
107
|
+
writable: true,
|
|
108
|
+
value: true
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(this, "hmacKey", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
configurable: true,
|
|
113
|
+
writable: true,
|
|
114
|
+
value: (0, crypto_1.randomBytes)(16)
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(this, "localPartialReliability", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
configurable: true,
|
|
119
|
+
writable: true,
|
|
120
|
+
value: true
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(this, "localPort", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
configurable: true,
|
|
125
|
+
writable: true,
|
|
126
|
+
value: void 0
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(this, "localVerificationTag", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
configurable: true,
|
|
131
|
+
writable: true,
|
|
132
|
+
value: (0, src_1.random32)()
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(this, "remoteExtensions", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
configurable: true,
|
|
137
|
+
writable: true,
|
|
138
|
+
value: []
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(this, "remotePartialReliability", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true,
|
|
143
|
+
writable: true,
|
|
144
|
+
value: true
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(this, "remotePort", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
configurable: true,
|
|
149
|
+
writable: true,
|
|
150
|
+
value: void 0
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(this, "remoteVerificationTag", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
configurable: true,
|
|
155
|
+
writable: true,
|
|
156
|
+
value: 0
|
|
157
|
+
});
|
|
67
158
|
// inbound
|
|
68
|
-
this
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this
|
|
159
|
+
Object.defineProperty(this, "advertisedRwnd", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
configurable: true,
|
|
162
|
+
writable: true,
|
|
163
|
+
value: 1024 * 1024
|
|
164
|
+
}); // Receiver Window
|
|
165
|
+
Object.defineProperty(this, "inboundStreams", {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
configurable: true,
|
|
168
|
+
writable: true,
|
|
169
|
+
value: {}
|
|
170
|
+
});
|
|
171
|
+
Object.defineProperty(this, "_inboundStreamsCount", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
configurable: true,
|
|
174
|
+
writable: true,
|
|
175
|
+
value: 0
|
|
176
|
+
});
|
|
177
|
+
Object.defineProperty(this, "_inboundStreamsMax", {
|
|
178
|
+
enumerable: true,
|
|
179
|
+
configurable: true,
|
|
180
|
+
writable: true,
|
|
181
|
+
value: MAX_STREAMS
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(this, "lastReceivedTsn", {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
configurable: true,
|
|
186
|
+
writable: true,
|
|
187
|
+
value: void 0
|
|
188
|
+
}); // Transmission Sequence Number
|
|
189
|
+
Object.defineProperty(this, "sackDuplicates", {
|
|
190
|
+
enumerable: true,
|
|
191
|
+
configurable: true,
|
|
192
|
+
writable: true,
|
|
193
|
+
value: []
|
|
194
|
+
});
|
|
195
|
+
Object.defineProperty(this, "sackMisOrdered", {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
configurable: true,
|
|
198
|
+
writable: true,
|
|
199
|
+
value: new Set()
|
|
200
|
+
});
|
|
201
|
+
Object.defineProperty(this, "sackNeeded", {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
configurable: true,
|
|
204
|
+
writable: true,
|
|
205
|
+
value: false
|
|
206
|
+
});
|
|
75
207
|
// # outbound
|
|
76
|
-
this
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
208
|
+
Object.defineProperty(this, "cwnd", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
configurable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
value: 3 * USERDATA_MAX_LENGTH
|
|
213
|
+
}); // Congestion Window
|
|
214
|
+
Object.defineProperty(this, "fastRecoveryExit", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
configurable: true,
|
|
217
|
+
writable: true,
|
|
218
|
+
value: void 0
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(this, "fastRecoveryTransmit", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
configurable: true,
|
|
223
|
+
writable: true,
|
|
224
|
+
value: false
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(this, "forwardTsnChunk", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
configurable: true,
|
|
229
|
+
writable: true,
|
|
230
|
+
value: void 0
|
|
231
|
+
});
|
|
232
|
+
Object.defineProperty(this, "flightSize", {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
configurable: true,
|
|
235
|
+
writable: true,
|
|
236
|
+
value: 0
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(this, "outboundQueue", {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
configurable: true,
|
|
241
|
+
writable: true,
|
|
242
|
+
value: []
|
|
243
|
+
});
|
|
244
|
+
Object.defineProperty(this, "outboundStreamSeq", {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
configurable: true,
|
|
247
|
+
writable: true,
|
|
248
|
+
value: {}
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(this, "_outboundStreamsCount", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
configurable: true,
|
|
253
|
+
writable: true,
|
|
254
|
+
value: MAX_STREAMS
|
|
255
|
+
});
|
|
82
256
|
/**local transmission sequence number */
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
257
|
+
Object.defineProperty(this, "localTsn", {
|
|
258
|
+
enumerable: true,
|
|
259
|
+
configurable: true,
|
|
260
|
+
writable: true,
|
|
261
|
+
value: Number((0, src_1.random32)())
|
|
262
|
+
});
|
|
263
|
+
Object.defineProperty(this, "lastSackedTsn", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
configurable: true,
|
|
266
|
+
writable: true,
|
|
267
|
+
value: tsnMinusOne(this.localTsn)
|
|
268
|
+
});
|
|
269
|
+
Object.defineProperty(this, "advancedPeerAckTsn", {
|
|
270
|
+
enumerable: true,
|
|
271
|
+
configurable: true,
|
|
272
|
+
writable: true,
|
|
273
|
+
value: tsnMinusOne(this.localTsn)
|
|
274
|
+
}); // acknowledgement
|
|
275
|
+
Object.defineProperty(this, "partialBytesAcked", {
|
|
276
|
+
enumerable: true,
|
|
277
|
+
configurable: true,
|
|
278
|
+
writable: true,
|
|
279
|
+
value: 0
|
|
280
|
+
});
|
|
281
|
+
Object.defineProperty(this, "sentQueue", {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
configurable: true,
|
|
284
|
+
writable: true,
|
|
285
|
+
value: []
|
|
286
|
+
});
|
|
88
287
|
// # reconfiguration
|
|
89
288
|
/**初期TSNと同じ値に初期化される単調に増加する数です. これは、新しいre-configuration requestパラメーターを送信するたびに1ずつ増加します */
|
|
90
|
-
this
|
|
289
|
+
Object.defineProperty(this, "reconfigRequestSeq", {
|
|
290
|
+
enumerable: true,
|
|
291
|
+
configurable: true,
|
|
292
|
+
writable: true,
|
|
293
|
+
value: this.localTsn
|
|
294
|
+
});
|
|
91
295
|
/**このフィールドは、incoming要求のre-configuration requestシーケンス番号を保持します. 他の場合では、次に予想されるre-configuration requestシーケンス番号から1を引いた値が保持されます */
|
|
92
|
-
this
|
|
93
|
-
|
|
296
|
+
Object.defineProperty(this, "reconfigResponseSeq", {
|
|
297
|
+
enumerable: true,
|
|
298
|
+
configurable: true,
|
|
299
|
+
writable: true,
|
|
300
|
+
value: 0
|
|
301
|
+
});
|
|
302
|
+
Object.defineProperty(this, "reconfigRequest", {
|
|
303
|
+
enumerable: true,
|
|
304
|
+
configurable: true,
|
|
305
|
+
writable: true,
|
|
306
|
+
value: void 0
|
|
307
|
+
});
|
|
308
|
+
Object.defineProperty(this, "reconfigQueue", {
|
|
309
|
+
enumerable: true,
|
|
310
|
+
configurable: true,
|
|
311
|
+
writable: true,
|
|
312
|
+
value: []
|
|
313
|
+
});
|
|
314
|
+
// rtt calculation
|
|
315
|
+
Object.defineProperty(this, "srtt", {
|
|
316
|
+
enumerable: true,
|
|
317
|
+
configurable: true,
|
|
318
|
+
writable: true,
|
|
319
|
+
value: void 0
|
|
320
|
+
});
|
|
321
|
+
Object.defineProperty(this, "rttvar", {
|
|
322
|
+
enumerable: true,
|
|
323
|
+
configurable: true,
|
|
324
|
+
writable: true,
|
|
325
|
+
value: void 0
|
|
326
|
+
});
|
|
94
327
|
// timers
|
|
95
|
-
this
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
328
|
+
Object.defineProperty(this, "rto", {
|
|
329
|
+
enumerable: true,
|
|
330
|
+
configurable: true,
|
|
331
|
+
writable: true,
|
|
332
|
+
value: SCTP_RTO_INITIAL
|
|
333
|
+
});
|
|
334
|
+
/**t1 is wait for initAck or cookieAck */
|
|
335
|
+
Object.defineProperty(this, "timer1Handle", {
|
|
336
|
+
enumerable: true,
|
|
337
|
+
configurable: true,
|
|
338
|
+
writable: true,
|
|
339
|
+
value: void 0
|
|
340
|
+
});
|
|
341
|
+
Object.defineProperty(this, "timer1Chunk", {
|
|
342
|
+
enumerable: true,
|
|
343
|
+
configurable: true,
|
|
344
|
+
writable: true,
|
|
345
|
+
value: void 0
|
|
346
|
+
});
|
|
347
|
+
Object.defineProperty(this, "timer1Failures", {
|
|
348
|
+
enumerable: true,
|
|
349
|
+
configurable: true,
|
|
350
|
+
writable: true,
|
|
351
|
+
value: 0
|
|
352
|
+
});
|
|
353
|
+
/**t2 is wait for shutdown */
|
|
354
|
+
Object.defineProperty(this, "timer2Handle", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: true,
|
|
358
|
+
value: void 0
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(this, "timer2Chunk", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
configurable: true,
|
|
363
|
+
writable: true,
|
|
364
|
+
value: void 0
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(this, "timer2Failures", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
configurable: true,
|
|
369
|
+
writable: true,
|
|
370
|
+
value: 0
|
|
371
|
+
});
|
|
372
|
+
/**t3 is wait for data sack */
|
|
373
|
+
Object.defineProperty(this, "timer3Handle", {
|
|
374
|
+
enumerable: true,
|
|
375
|
+
configurable: true,
|
|
376
|
+
writable: true,
|
|
377
|
+
value: void 0
|
|
378
|
+
});
|
|
379
|
+
/**Re-configuration Timer */
|
|
380
|
+
Object.defineProperty(this, "timerReconfigHandle", {
|
|
381
|
+
enumerable: true,
|
|
382
|
+
configurable: true,
|
|
383
|
+
writable: true,
|
|
384
|
+
value: void 0
|
|
385
|
+
});
|
|
386
|
+
Object.defineProperty(this, "timerReconfigFailures", {
|
|
387
|
+
enumerable: true,
|
|
388
|
+
configurable: true,
|
|
389
|
+
writable: true,
|
|
390
|
+
value: 0
|
|
391
|
+
});
|
|
392
|
+
// etc
|
|
393
|
+
Object.defineProperty(this, "ssthresh", {
|
|
394
|
+
enumerable: true,
|
|
395
|
+
configurable: true,
|
|
396
|
+
writable: true,
|
|
397
|
+
value: void 0
|
|
398
|
+
}); // slow start threshold
|
|
399
|
+
Object.defineProperty(this, "send", {
|
|
400
|
+
enumerable: true,
|
|
401
|
+
configurable: true,
|
|
402
|
+
writable: true,
|
|
403
|
+
value: async (streamId, ppId, userData, { expiry, maxRetransmits, ordered, } = { expiry: undefined, maxRetransmits: undefined, ordered: true }) => {
|
|
404
|
+
const streamSeqNum = ordered ? this.outboundStreamSeq[streamId] || 0 : 0;
|
|
405
|
+
const fragments = Math.ceil(userData.length / USERDATA_MAX_LENGTH);
|
|
406
|
+
let pos = 0;
|
|
407
|
+
const chunks = [];
|
|
408
|
+
for (const fragment of (0, range_1.default)(0, fragments)) {
|
|
409
|
+
const chunk = new chunk_1.DataChunk(0, undefined);
|
|
410
|
+
chunk.flags = 0;
|
|
411
|
+
if (!ordered) {
|
|
412
|
+
chunk.flags = SCTP_DATA_UNORDERED;
|
|
413
|
+
}
|
|
414
|
+
if (fragment === 0) {
|
|
415
|
+
chunk.flags |= SCTP_DATA_FIRST_FRAG;
|
|
416
|
+
}
|
|
417
|
+
if (fragment === fragments - 1) {
|
|
418
|
+
chunk.flags |= SCTP_DATA_LAST_FRAG;
|
|
419
|
+
}
|
|
420
|
+
chunk.tsn = this.localTsn;
|
|
421
|
+
chunk.streamId = streamId;
|
|
422
|
+
chunk.streamSeqNum = streamSeqNum;
|
|
423
|
+
chunk.protocol = ppId;
|
|
424
|
+
chunk.userData = userData.slice(pos, pos + USERDATA_MAX_LENGTH);
|
|
425
|
+
chunk.bookSize = chunk.userData.length;
|
|
426
|
+
chunk.expiry = expiry;
|
|
427
|
+
chunk.maxRetransmits = maxRetransmits;
|
|
428
|
+
pos += USERDATA_MAX_LENGTH;
|
|
429
|
+
this.localTsn = tsnPlusOne(this.localTsn);
|
|
430
|
+
chunks.push(chunk);
|
|
109
431
|
}
|
|
110
|
-
|
|
111
|
-
chunk
|
|
432
|
+
chunks.forEach((chunk) => {
|
|
433
|
+
this.outboundQueue.push(chunk);
|
|
434
|
+
});
|
|
435
|
+
if (ordered) {
|
|
436
|
+
this.outboundStreamSeq[streamId] = (0, src_1.uint16Add)(streamSeqNum, 1);
|
|
112
437
|
}
|
|
113
|
-
if (
|
|
114
|
-
|
|
438
|
+
if (!this.timer3Handle) {
|
|
439
|
+
await this.transmit();
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
await new Promise((r) => setImmediate(r));
|
|
115
443
|
}
|
|
116
|
-
chunk.tsn = this.localTsn;
|
|
117
|
-
chunk.streamId = streamId;
|
|
118
|
-
chunk.streamSeqNum = streamSeqNum;
|
|
119
|
-
chunk.protocol = ppId;
|
|
120
|
-
chunk.userData = userData.slice(pos, pos + USERDATA_MAX_LENGTH);
|
|
121
|
-
chunk.bookSize = chunk.userData.length;
|
|
122
|
-
chunk.expiry = expiry;
|
|
123
|
-
chunk.maxRetransmits = maxRetransmits;
|
|
124
|
-
pos += USERDATA_MAX_LENGTH;
|
|
125
|
-
this.localTsn = tsnPlusOne(this.localTsn);
|
|
126
|
-
chunks.push(chunk);
|
|
127
|
-
}
|
|
128
|
-
chunks.forEach((chunk) => {
|
|
129
|
-
this.outboundQueue.push(chunk);
|
|
130
|
-
});
|
|
131
|
-
if (ordered) {
|
|
132
|
-
this.outboundStreamSeq[streamId] = (0, src_1.uint16Add)(streamSeqNum, 1);
|
|
133
|
-
}
|
|
134
|
-
if (!this.timer3Handle) {
|
|
135
|
-
await this.transmit();
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
await new Promise((r) => setImmediate(r));
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
this.timer1Expired = () => {
|
|
142
|
-
this.timer1Failures++;
|
|
143
|
-
this.timer1Handle = undefined;
|
|
144
|
-
if (this.timer1Failures > SCTP_MAX_INIT_RETRANS) {
|
|
145
|
-
this.setState(const_1.SCTP_STATE.CLOSED);
|
|
146
444
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
445
|
+
});
|
|
446
|
+
Object.defineProperty(this, "timer1Expired", {
|
|
447
|
+
enumerable: true,
|
|
448
|
+
configurable: true,
|
|
449
|
+
writable: true,
|
|
450
|
+
value: () => {
|
|
451
|
+
this.timer1Failures++;
|
|
452
|
+
this.timer1Handle = undefined;
|
|
453
|
+
if (this.timer1Failures > SCTP_MAX_INIT_RETRANS) {
|
|
454
|
+
this.setState(const_1.SCTP_STATE.CLOSED);
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
setImmediate(() => {
|
|
458
|
+
this.sendChunk(this.timer1Chunk).catch((err) => {
|
|
459
|
+
log("send timer1 chunk failed", err.message);
|
|
460
|
+
});
|
|
151
461
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
this.timer2Expired = () => {
|
|
157
|
-
this.timer2Failures++;
|
|
158
|
-
this.timer2Handle = undefined;
|
|
159
|
-
if (this.timer2Failures > SCTP_MAX_ASSOCIATION_RETRANS) {
|
|
160
|
-
this.setState(const_1.SCTP_STATE.CLOSED);
|
|
462
|
+
this.timer1Handle = setTimeout(this.timer1Expired, this.rto * 1000);
|
|
463
|
+
}
|
|
161
464
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
465
|
+
});
|
|
466
|
+
Object.defineProperty(this, "timer2Expired", {
|
|
467
|
+
enumerable: true,
|
|
468
|
+
configurable: true,
|
|
469
|
+
writable: true,
|
|
470
|
+
value: () => {
|
|
471
|
+
this.timer2Failures++;
|
|
472
|
+
this.timer2Handle = undefined;
|
|
473
|
+
if (this.timer2Failures > SCTP_MAX_ASSOCIATION_RETRANS) {
|
|
474
|
+
this.setState(const_1.SCTP_STATE.CLOSED);
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
setImmediate(() => {
|
|
478
|
+
this.sendChunk(this.timer2Chunk).catch((err) => {
|
|
479
|
+
log("send timer2Chunk failed", err.message);
|
|
480
|
+
});
|
|
166
481
|
});
|
|
482
|
+
this.timer2Handle = setTimeout(this.timer2Expired, this.rto * 1000);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
Object.defineProperty(this, "timer3Expired", {
|
|
487
|
+
enumerable: true,
|
|
488
|
+
configurable: true,
|
|
489
|
+
writable: true,
|
|
490
|
+
value: () => {
|
|
491
|
+
this.timer3Handle = undefined;
|
|
492
|
+
// # mark retransmit or abandoned chunks
|
|
493
|
+
this.sentQueue.forEach((chunk) => {
|
|
494
|
+
if (!this.maybeAbandon(chunk)) {
|
|
495
|
+
chunk.retransmit = true;
|
|
496
|
+
}
|
|
167
497
|
});
|
|
168
|
-
this.
|
|
498
|
+
this.updateAdvancedPeerAckPoint();
|
|
499
|
+
// # adjust congestion window
|
|
500
|
+
this.fastRecoveryExit = undefined;
|
|
501
|
+
this.flightSize = 0;
|
|
502
|
+
this.partialBytesAcked = 0;
|
|
503
|
+
this.ssthresh = Math.max(Math.floor(this.cwnd / 2), 4 * USERDATA_MAX_LENGTH);
|
|
504
|
+
this.cwnd = USERDATA_MAX_LENGTH;
|
|
505
|
+
this.transmit();
|
|
169
506
|
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
507
|
+
});
|
|
508
|
+
Object.defineProperty(this, "timerReconfigHandleExpired", {
|
|
509
|
+
enumerable: true,
|
|
510
|
+
configurable: true,
|
|
511
|
+
writable: true,
|
|
512
|
+
value: async () => {
|
|
513
|
+
this.timerReconfigFailures++;
|
|
514
|
+
// back off
|
|
515
|
+
this.rto = Math.ceil(this.rto * 1.5);
|
|
516
|
+
if (this.timerReconfigFailures > SCTP_MAX_ASSOCIATION_RETRANS) {
|
|
517
|
+
log("timerReconfigFailures", this.timerReconfigFailures);
|
|
518
|
+
this.setState(const_1.SCTP_STATE.CLOSED);
|
|
519
|
+
this.timerReconfigHandle = undefined;
|
|
520
|
+
}
|
|
521
|
+
else if (this.reconfigRequest) {
|
|
522
|
+
log("timerReconfigHandleExpired", this.timerReconfigFailures, this.rto);
|
|
523
|
+
await this.sendReconfigParam(this.reconfigRequest);
|
|
524
|
+
this.timerReconfigHandle = setTimeout(this.timerReconfigHandleExpired, this.rto * 1000);
|
|
177
525
|
}
|
|
178
|
-
});
|
|
179
|
-
this.updateAdvancedPeerAckPoint();
|
|
180
|
-
// # adjust congestion window
|
|
181
|
-
this.fastRecoveryExit = undefined;
|
|
182
|
-
this.flightSize = 0;
|
|
183
|
-
this.partialBytesAcked = 0;
|
|
184
|
-
this.ssthresh = Math.max(Math.floor(this.cwnd / 2), 4 * USERDATA_MAX_LENGTH);
|
|
185
|
-
this.cwnd = USERDATA_MAX_LENGTH;
|
|
186
|
-
this.transmit();
|
|
187
|
-
};
|
|
188
|
-
this.timerReconfigHandleExpired = async () => {
|
|
189
|
-
this.timerReconfigFailures++;
|
|
190
|
-
// back off
|
|
191
|
-
this.rto = Math.ceil(this.rto * 1.5);
|
|
192
|
-
if (this.timerReconfigFailures > SCTP_MAX_ASSOCIATION_RETRANS) {
|
|
193
|
-
log("timerReconfigFailures", this.timerReconfigFailures);
|
|
194
|
-
this.setState(const_1.SCTP_STATE.CLOSED);
|
|
195
|
-
this.timerReconfigHandle = undefined;
|
|
196
|
-
}
|
|
197
|
-
else if (this.reconfigRequest) {
|
|
198
|
-
log("timerReconfigHandleExpired", this.timerReconfigFailures, this.rto);
|
|
199
|
-
await this.sendReconfigParam(this.reconfigRequest);
|
|
200
|
-
this.timerReconfigHandle = setTimeout(this.timerReconfigHandleExpired, this.rto * 1000);
|
|
201
526
|
}
|
|
202
|
-
};
|
|
527
|
+
});
|
|
528
|
+
this.localPort = this.port;
|
|
203
529
|
this.transport.onData = (buf) => {
|
|
204
530
|
this.handleData(buf);
|
|
205
531
|
};
|
|
@@ -998,8 +1324,18 @@ class SCTP {
|
|
|
998
1324
|
exports.SCTP = SCTP;
|
|
999
1325
|
class InboundStream {
|
|
1000
1326
|
constructor() {
|
|
1001
|
-
this
|
|
1002
|
-
|
|
1327
|
+
Object.defineProperty(this, "reassembly", {
|
|
1328
|
+
enumerable: true,
|
|
1329
|
+
configurable: true,
|
|
1330
|
+
writable: true,
|
|
1331
|
+
value: []
|
|
1332
|
+
});
|
|
1333
|
+
Object.defineProperty(this, "streamSequenceNumber", {
|
|
1334
|
+
enumerable: true,
|
|
1335
|
+
configurable: true,
|
|
1336
|
+
writable: true,
|
|
1337
|
+
value: 0
|
|
1338
|
+
}); // SSN
|
|
1003
1339
|
}
|
|
1004
1340
|
addChunk(chunk) {
|
|
1005
1341
|
if (this.reassembly.length === 0 ||
|
|
@@ -1099,7 +1435,12 @@ class InboundStream {
|
|
|
1099
1435
|
exports.InboundStream = InboundStream;
|
|
1100
1436
|
class RTCSctpCapabilities {
|
|
1101
1437
|
constructor(maxMessageSize) {
|
|
1102
|
-
this
|
|
1438
|
+
Object.defineProperty(this, "maxMessageSize", {
|
|
1439
|
+
enumerable: true,
|
|
1440
|
+
configurable: true,
|
|
1441
|
+
writable: true,
|
|
1442
|
+
value: maxMessageSize
|
|
1443
|
+
});
|
|
1103
1444
|
}
|
|
1104
1445
|
}
|
|
1105
1446
|
exports.RTCSctpCapabilities = RTCSctpCapabilities;
|