protocol-quic 0.0.0 → 0.0.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ext/rakefile.rb +12 -0
- data/ext/ruby-protocol-quic-lock.yml +67 -0
- data/ext/teapot.rb +49 -0
- data/lib/protocol/quic/version.rb +4 -2
- data/lib/protocol/quic.rb +5 -5
- data/license.md +1 -1
- data/readme.md +55 -0
- data/releases.md +3 -0
- data.tar.gz.sig +0 -0
- metadata +32 -350
- metadata.gz.sig +0 -0
- data/ext/ngtcp2/AUTHORS +0 -44
- data/ext/ngtcp2/CMakeLists.txt +0 -431
- data/ext/ngtcp2/CMakeOptions.txt +0 -17
- data/ext/ngtcp2/COPYING +0 -22
- data/ext/ngtcp2/ChangeLog +0 -0
- data/ext/ngtcp2/Makefile.am +0 -60
- data/ext/ngtcp2/NEWS +0 -0
- data/ext/ngtcp2/README +0 -1
- data/ext/ngtcp2/README.rst +0 -258
- data/ext/ngtcp2/ci/build_boringssl.sh +0 -10
- data/ext/ngtcp2/ci/build_nghttp3.sh +0 -9
- data/ext/ngtcp2/ci/build_openssl1.sh +0 -8
- data/ext/ngtcp2/ci/build_openssl1_cross.sh +0 -9
- data/ext/ngtcp2/ci/build_openssl3.sh +0 -8
- data/ext/ngtcp2/ci/build_picotls.sh +0 -26
- data/ext/ngtcp2/ci/build_wolfssl.sh +0 -9
- data/ext/ngtcp2/ci/gen-certificate.sh +0 -8
- data/ext/ngtcp2/cmake/ExtractValidFlags.cmake +0 -31
- data/ext/ngtcp2/cmake/FindCUnit.cmake +0 -40
- data/ext/ngtcp2/cmake/FindJemalloc.cmake +0 -40
- data/ext/ngtcp2/cmake/FindLibev.cmake +0 -38
- data/ext/ngtcp2/cmake/FindLibnghttp3.cmake +0 -41
- data/ext/ngtcp2/cmake/Findwolfssl.cmake +0 -41
- data/ext/ngtcp2/cmake/Version.cmake +0 -11
- data/ext/ngtcp2/cmakeconfig.h.in +0 -36
- data/ext/ngtcp2/configure.ac +0 -755
- data/ext/ngtcp2/crypto/CMakeLists.txt +0 -56
- data/ext/ngtcp2/crypto/Makefile.am +0 -49
- data/ext/ngtcp2/crypto/boringssl/CMakeLists.txt +0 -64
- data/ext/ngtcp2/crypto/boringssl/Makefile.am +0 -39
- data/ext/ngtcp2/crypto/boringssl/boringssl.c +0 -630
- data/ext/ngtcp2/crypto/boringssl/libngtcp2_crypto_boringssl.pc.in +0 -33
- data/ext/ngtcp2/crypto/gnutls/CMakeLists.txt +0 -86
- data/ext/ngtcp2/crypto/gnutls/Makefile.am +0 -43
- data/ext/ngtcp2/crypto/gnutls/gnutls.c +0 -644
- data/ext/ngtcp2/crypto/gnutls/libngtcp2_crypto_gnutls.pc.in +0 -33
- data/ext/ngtcp2/crypto/includes/CMakeLists.txt +0 -56
- data/ext/ngtcp2/crypto/includes/Makefile.am +0 -45
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h +0 -893
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_boringssl.h +0 -104
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_gnutls.h +0 -107
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_openssl.h +0 -132
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_picotls.h +0 -246
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_wolfssl.h +0 -106
- data/ext/ngtcp2/crypto/openssl/CMakeLists.txt +0 -86
- data/ext/ngtcp2/crypto/openssl/Makefile.am +0 -43
- data/ext/ngtcp2/crypto/openssl/libngtcp2_crypto_openssl.pc.in +0 -33
- data/ext/ngtcp2/crypto/openssl/openssl.c +0 -807
- data/ext/ngtcp2/crypto/picotls/CMakeLists.txt +0 -65
- data/ext/ngtcp2/crypto/picotls/Makefile.am +0 -39
- data/ext/ngtcp2/crypto/picotls/libngtcp2_crypto_picotls.pc.in +0 -33
- data/ext/ngtcp2/crypto/picotls/picotls.c +0 -707
- data/ext/ngtcp2/crypto/shared.c +0 -1431
- data/ext/ngtcp2/crypto/shared.h +0 -350
- data/ext/ngtcp2/crypto/wolfssl/CMakeLists.txt +0 -84
- data/ext/ngtcp2/crypto/wolfssl/Makefile.am +0 -43
- data/ext/ngtcp2/crypto/wolfssl/libngtcp2_crypto_wolfssl.pc.in +0 -33
- data/ext/ngtcp2/crypto/wolfssl/wolfssl.c +0 -534
- data/ext/ngtcp2/doc/Makefile.am +0 -65
- data/ext/ngtcp2/doc/make.bat +0 -35
- data/ext/ngtcp2/doc/mkapiref.py +0 -356
- data/ext/ngtcp2/doc/source/conf.py.in +0 -94
- data/ext/ngtcp2/doc/source/index.rst +0 -22
- data/ext/ngtcp2/doc/source/programmers-guide.rst +0 -476
- data/ext/ngtcp2/docker/Dockerfile +0 -39
- data/ext/ngtcp2/examples/CMakeLists.txt +0 -361
- data/ext/ngtcp2/examples/Makefile.am +0 -228
- data/ext/ngtcp2/examples/client.cc +0 -3049
- data/ext/ngtcp2/examples/client.h +0 -192
- data/ext/ngtcp2/examples/client_base.cc +0 -202
- data/ext/ngtcp2/examples/client_base.h +0 -213
- data/ext/ngtcp2/examples/debug.cc +0 -298
- data/ext/ngtcp2/examples/debug.h +0 -124
- data/ext/ngtcp2/examples/examplestest.cc +0 -84
- data/ext/ngtcp2/examples/gtlssimpleclient.c +0 -720
- data/ext/ngtcp2/examples/h09client.cc +0 -2601
- data/ext/ngtcp2/examples/h09client.h +0 -196
- data/ext/ngtcp2/examples/h09server.cc +0 -3024
- data/ext/ngtcp2/examples/h09server.h +0 -237
- data/ext/ngtcp2/examples/http.cc +0 -138
- data/ext/ngtcp2/examples/http.h +0 -44
- data/ext/ngtcp2/examples/network.h +0 -80
- data/ext/ngtcp2/examples/server.cc +0 -3731
- data/ext/ngtcp2/examples/server.h +0 -256
- data/ext/ngtcp2/examples/server_base.cc +0 -58
- data/ext/ngtcp2/examples/server_base.h +0 -195
- data/ext/ngtcp2/examples/shared.cc +0 -385
- data/ext/ngtcp2/examples/shared.h +0 -96
- data/ext/ngtcp2/examples/simpleclient.c +0 -683
- data/ext/ngtcp2/examples/template.h +0 -71
- data/ext/ngtcp2/examples/tests/README.rst +0 -60
- data/ext/ngtcp2/examples/tests/__init__.py +0 -0
- data/ext/ngtcp2/examples/tests/config.ini.in +0 -32
- data/ext/ngtcp2/examples/tests/conftest.py +0 -28
- data/ext/ngtcp2/examples/tests/ngtcp2test/__init__.py +0 -6
- data/ext/ngtcp2/examples/tests/ngtcp2test/certs.py +0 -476
- data/ext/ngtcp2/examples/tests/ngtcp2test/client.py +0 -187
- data/ext/ngtcp2/examples/tests/ngtcp2test/env.py +0 -191
- data/ext/ngtcp2/examples/tests/ngtcp2test/log.py +0 -101
- data/ext/ngtcp2/examples/tests/ngtcp2test/server.py +0 -137
- data/ext/ngtcp2/examples/tests/ngtcp2test/tls.py +0 -983
- data/ext/ngtcp2/examples/tests/test_01_handshake.py +0 -30
- data/ext/ngtcp2/examples/tests/test_02_resume.py +0 -46
- data/ext/ngtcp2/examples/tests/test_03_earlydata.py +0 -56
- data/ext/ngtcp2/examples/tests/test_04_clientcert.py +0 -57
- data/ext/ngtcp2/examples/tests/test_05_ciphers.py +0 -46
- data/ext/ngtcp2/examples/tls_client_context.h +0 -52
- data/ext/ngtcp2/examples/tls_client_context_boringssl.cc +0 -126
- data/ext/ngtcp2/examples/tls_client_context_boringssl.h +0 -49
- data/ext/ngtcp2/examples/tls_client_context_gnutls.cc +0 -74
- data/ext/ngtcp2/examples/tls_client_context_gnutls.h +0 -50
- data/ext/ngtcp2/examples/tls_client_context_openssl.cc +0 -137
- data/ext/ngtcp2/examples/tls_client_context_openssl.h +0 -49
- data/ext/ngtcp2/examples/tls_client_context_picotls.cc +0 -158
- data/ext/ngtcp2/examples/tls_client_context_picotls.h +0 -53
- data/ext/ngtcp2/examples/tls_client_context_wolfssl.cc +0 -177
- data/ext/ngtcp2/examples/tls_client_context_wolfssl.h +0 -51
- data/ext/ngtcp2/examples/tls_client_session.h +0 -52
- data/ext/ngtcp2/examples/tls_client_session_boringssl.cc +0 -110
- data/ext/ngtcp2/examples/tls_client_session_boringssl.h +0 -52
- data/ext/ngtcp2/examples/tls_client_session_gnutls.cc +0 -190
- data/ext/ngtcp2/examples/tls_client_session_gnutls.h +0 -52
- data/ext/ngtcp2/examples/tls_client_session_openssl.cc +0 -113
- data/ext/ngtcp2/examples/tls_client_session_openssl.h +0 -52
- data/ext/ngtcp2/examples/tls_client_session_picotls.cc +0 -147
- data/ext/ngtcp2/examples/tls_client_session_picotls.h +0 -52
- data/ext/ngtcp2/examples/tls_client_session_wolfssl.cc +0 -160
- data/ext/ngtcp2/examples/tls_client_session_wolfssl.h +0 -52
- data/ext/ngtcp2/examples/tls_server_context.h +0 -52
- data/ext/ngtcp2/examples/tls_server_context_boringssl.cc +0 -257
- data/ext/ngtcp2/examples/tls_server_context_boringssl.h +0 -54
- data/ext/ngtcp2/examples/tls_server_context_gnutls.cc +0 -99
- data/ext/ngtcp2/examples/tls_server_context_gnutls.h +0 -59
- data/ext/ngtcp2/examples/tls_server_context_openssl.cc +0 -338
- data/ext/ngtcp2/examples/tls_server_context_openssl.h +0 -54
- data/ext/ngtcp2/examples/tls_server_context_picotls.cc +0 -321
- data/ext/ngtcp2/examples/tls_server_context_picotls.h +0 -58
- data/ext/ngtcp2/examples/tls_server_context_wolfssl.cc +0 -284
- data/ext/ngtcp2/examples/tls_server_context_wolfssl.h +0 -55
- data/ext/ngtcp2/examples/tls_server_session.h +0 -52
- data/ext/ngtcp2/examples/tls_server_session_boringssl.cc +0 -84
- data/ext/ngtcp2/examples/tls_server_session_boringssl.h +0 -47
- data/ext/ngtcp2/examples/tls_server_session_gnutls.cc +0 -155
- data/ext/ngtcp2/examples/tls_server_session_gnutls.h +0 -46
- data/ext/ngtcp2/examples/tls_server_session_openssl.cc +0 -54
- data/ext/ngtcp2/examples/tls_server_session_openssl.h +0 -47
- data/ext/ngtcp2/examples/tls_server_session_picotls.cc +0 -70
- data/ext/ngtcp2/examples/tls_server_session_picotls.h +0 -47
- data/ext/ngtcp2/examples/tls_server_session_wolfssl.cc +0 -55
- data/ext/ngtcp2/examples/tls_server_session_wolfssl.h +0 -47
- data/ext/ngtcp2/examples/tls_session_base_gnutls.cc +0 -87
- data/ext/ngtcp2/examples/tls_session_base_gnutls.h +0 -51
- data/ext/ngtcp2/examples/tls_session_base_openssl.cc +0 -54
- data/ext/ngtcp2/examples/tls_session_base_openssl.h +0 -52
- data/ext/ngtcp2/examples/tls_session_base_picotls.cc +0 -56
- data/ext/ngtcp2/examples/tls_session_base_picotls.h +0 -54
- data/ext/ngtcp2/examples/tls_session_base_wolfssl.cc +0 -54
- data/ext/ngtcp2/examples/tls_session_base_wolfssl.h +0 -54
- data/ext/ngtcp2/examples/tls_shared_picotls.cc +0 -59
- data/ext/ngtcp2/examples/tls_shared_picotls.h +0 -36
- data/ext/ngtcp2/examples/util.cc +0 -646
- data/ext/ngtcp2/examples/util.h +0 -361
- data/ext/ngtcp2/examples/util_gnutls.cc +0 -136
- data/ext/ngtcp2/examples/util_openssl.cc +0 -131
- data/ext/ngtcp2/examples/util_test.cc +0 -237
- data/ext/ngtcp2/examples/util_test.h +0 -45
- data/ext/ngtcp2/examples/util_wolfssl.cc +0 -130
- data/ext/ngtcp2/fuzz/corpus/decode_frame/ack +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/ack_ecn +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/connection_close +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/crypto +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/data_blocked +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/datagram +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/datagram_len +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_data +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_stream_data +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_streams +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/new_connection_id +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/new_token +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/path_challenge +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/path_response +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/reset_stream +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/retire_connection_id +0 -1
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stop_sending +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream_data_blocked +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream_len +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/streams_blocked +0 -0
- data/ext/ngtcp2/fuzz/corpus/ksl/random +0 -0
- data/ext/ngtcp2/fuzz/decode_frame.cc +0 -25
- data/ext/ngtcp2/fuzz/ksl.cc +0 -77
- data/ext/ngtcp2/interop/Dockerfile +0 -39
- data/ext/ngtcp2/interop/run_endpoint.sh +0 -93
- data/ext/ngtcp2/lib/CMakeLists.txt +0 -110
- data/ext/ngtcp2/lib/Makefile.am +0 -122
- data/ext/ngtcp2/lib/includes/CMakeLists.txt +0 -4
- data/ext/ngtcp2/lib/includes/Makefile.am +0 -25
- data/ext/ngtcp2/lib/includes/ngtcp2/ngtcp2.h +0 -5843
- data/ext/ngtcp2/lib/includes/ngtcp2/version.h.in +0 -51
- data/ext/ngtcp2/lib/libngtcp2.pc.in +0 -33
- data/ext/ngtcp2/lib/ngtcp2_acktr.c +0 -335
- data/ext/ngtcp2/lib/ngtcp2_acktr.h +0 -221
- data/ext/ngtcp2/lib/ngtcp2_addr.c +0 -117
- data/ext/ngtcp2/lib/ngtcp2_addr.h +0 -69
- data/ext/ngtcp2/lib/ngtcp2_balloc.c +0 -90
- data/ext/ngtcp2/lib/ngtcp2_balloc.h +0 -91
- data/ext/ngtcp2/lib/ngtcp2_bbr.c +0 -693
- data/ext/ngtcp2/lib/ngtcp2_bbr.h +0 -157
- data/ext/ngtcp2/lib/ngtcp2_bbr2.c +0 -1490
- data/ext/ngtcp2/lib/ngtcp2_bbr2.h +0 -149
- data/ext/ngtcp2/lib/ngtcp2_buf.c +0 -56
- data/ext/ngtcp2/lib/ngtcp2_buf.h +0 -108
- data/ext/ngtcp2/lib/ngtcp2_cc.c +0 -616
- data/ext/ngtcp2/lib/ngtcp2_cc.h +0 -422
- data/ext/ngtcp2/lib/ngtcp2_cid.c +0 -147
- data/ext/ngtcp2/lib/ngtcp2_cid.h +0 -175
- data/ext/ngtcp2/lib/ngtcp2_conn.c +0 -13731
- data/ext/ngtcp2/lib/ngtcp2_conn.h +0 -1119
- data/ext/ngtcp2/lib/ngtcp2_conn_stat.h +0 -131
- data/ext/ngtcp2/lib/ngtcp2_conv.c +0 -291
- data/ext/ngtcp2/lib/ngtcp2_conv.h +0 -208
- data/ext/ngtcp2/lib/ngtcp2_crypto.c +0 -895
- data/ext/ngtcp2/lib/ngtcp2_crypto.h +0 -148
- data/ext/ngtcp2/lib/ngtcp2_err.c +0 -154
- data/ext/ngtcp2/lib/ngtcp2_err.h +0 -34
- data/ext/ngtcp2/lib/ngtcp2_gaptr.c +0 -167
- data/ext/ngtcp2/lib/ngtcp2_gaptr.h +0 -98
- data/ext/ngtcp2/lib/ngtcp2_idtr.c +0 -79
- data/ext/ngtcp2/lib/ngtcp2_idtr.h +0 -89
- data/ext/ngtcp2/lib/ngtcp2_ksl.c +0 -819
- data/ext/ngtcp2/lib/ngtcp2_ksl.h +0 -345
- data/ext/ngtcp2/lib/ngtcp2_log.c +0 -822
- data/ext/ngtcp2/lib/ngtcp2_log.h +0 -123
- data/ext/ngtcp2/lib/ngtcp2_macro.h +0 -58
- data/ext/ngtcp2/lib/ngtcp2_map.c +0 -336
- data/ext/ngtcp2/lib/ngtcp2_map.h +0 -136
- data/ext/ngtcp2/lib/ngtcp2_mem.c +0 -113
- data/ext/ngtcp2/lib/ngtcp2_mem.h +0 -72
- data/ext/ngtcp2/lib/ngtcp2_net.h +0 -136
- data/ext/ngtcp2/lib/ngtcp2_objalloc.c +0 -40
- data/ext/ngtcp2/lib/ngtcp2_objalloc.h +0 -140
- data/ext/ngtcp2/lib/ngtcp2_opl.c +0 -46
- data/ext/ngtcp2/lib/ngtcp2_opl.h +0 -65
- data/ext/ngtcp2/lib/ngtcp2_path.c +0 -77
- data/ext/ngtcp2/lib/ngtcp2_path.h +0 -49
- data/ext/ngtcp2/lib/ngtcp2_pkt.c +0 -2527
- data/ext/ngtcp2/lib/ngtcp2_pkt.h +0 -1235
- data/ext/ngtcp2/lib/ngtcp2_pmtud.c +0 -160
- data/ext/ngtcp2/lib/ngtcp2_pmtud.h +0 -123
- data/ext/ngtcp2/lib/ngtcp2_ppe.c +0 -230
- data/ext/ngtcp2/lib/ngtcp2_ppe.h +0 -153
- data/ext/ngtcp2/lib/ngtcp2_pq.c +0 -164
- data/ext/ngtcp2/lib/ngtcp2_pq.h +0 -126
- data/ext/ngtcp2/lib/ngtcp2_pv.c +0 -172
- data/ext/ngtcp2/lib/ngtcp2_pv.h +0 -194
- data/ext/ngtcp2/lib/ngtcp2_qlog.c +0 -1219
- data/ext/ngtcp2/lib/ngtcp2_qlog.h +0 -161
- data/ext/ngtcp2/lib/ngtcp2_range.c +0 -61
- data/ext/ngtcp2/lib/ngtcp2_range.h +0 -80
- data/ext/ngtcp2/lib/ngtcp2_rcvry.h +0 -40
- data/ext/ngtcp2/lib/ngtcp2_ringbuf.c +0 -121
- data/ext/ngtcp2/lib/ngtcp2_ringbuf.h +0 -132
- data/ext/ngtcp2/lib/ngtcp2_rob.c +0 -319
- data/ext/ngtcp2/lib/ngtcp2_rob.h +0 -197
- data/ext/ngtcp2/lib/ngtcp2_rst.c +0 -138
- data/ext/ngtcp2/lib/ngtcp2_rst.h +0 -86
- data/ext/ngtcp2/lib/ngtcp2_rtb.c +0 -1676
- data/ext/ngtcp2/lib/ngtcp2_rtb.h +0 -468
- data/ext/ngtcp2/lib/ngtcp2_str.c +0 -233
- data/ext/ngtcp2/lib/ngtcp2_str.h +0 -94
- data/ext/ngtcp2/lib/ngtcp2_strm.c +0 -698
- data/ext/ngtcp2/lib/ngtcp2_strm.h +0 -310
- data/ext/ngtcp2/lib/ngtcp2_unreachable.c +0 -71
- data/ext/ngtcp2/lib/ngtcp2_unreachable.h +0 -46
- data/ext/ngtcp2/lib/ngtcp2_vec.c +0 -243
- data/ext/ngtcp2/lib/ngtcp2_vec.h +0 -120
- data/ext/ngtcp2/lib/ngtcp2_version.c +0 -39
- data/ext/ngtcp2/lib/ngtcp2_window_filter.c +0 -99
- data/ext/ngtcp2/lib/ngtcp2_window_filter.h +0 -65
- data/ext/ngtcp2/m4/ax_check_compile_flag.m4 +0 -74
- data/ext/ngtcp2/m4/ax_cxx_compile_stdcxx.m4 +0 -1009
- data/ext/ngtcp2/tests/CMakeLists.txt +0 -68
- data/ext/ngtcp2/tests/Makefile.am +0 -94
- data/ext/ngtcp2/tests/main.c +0 -358
- data/ext/ngtcp2/tests/ngtcp2_acktr_test.c +0 -367
- data/ext/ngtcp2/tests/ngtcp2_acktr_test.h +0 -37
- data/ext/ngtcp2/tests/ngtcp2_conn_test.c +0 -9821
- data/ext/ngtcp2/tests/ngtcp2_conn_test.h +0 -104
- data/ext/ngtcp2/tests/ngtcp2_conv_test.c +0 -430
- data/ext/ngtcp2/tests/ngtcp2_conv_test.h +0 -46
- data/ext/ngtcp2/tests/ngtcp2_crypto_test.c +0 -667
- data/ext/ngtcp2/tests/ngtcp2_crypto_test.h +0 -35
- data/ext/ngtcp2/tests/ngtcp2_gaptr_test.c +0 -127
- data/ext/ngtcp2/tests/ngtcp2_gaptr_test.h +0 -36
- data/ext/ngtcp2/tests/ngtcp2_idtr_test.c +0 -79
- data/ext/ngtcp2/tests/ngtcp2_idtr_test.h +0 -34
- data/ext/ngtcp2/tests/ngtcp2_ksl_test.c +0 -502
- data/ext/ngtcp2/tests/ngtcp2_ksl_test.h +0 -39
- data/ext/ngtcp2/tests/ngtcp2_map_test.c +0 -206
- data/ext/ngtcp2/tests/ngtcp2_map_test.h +0 -38
- data/ext/ngtcp2/tests/ngtcp2_pkt_test.c +0 -1645
- data/ext/ngtcp2/tests/ngtcp2_pkt_test.h +0 -68
- data/ext/ngtcp2/tests/ngtcp2_pmtud_test.c +0 -153
- data/ext/ngtcp2/tests/ngtcp2_pmtud_test.h +0 -34
- data/ext/ngtcp2/tests/ngtcp2_pv_test.c +0 -129
- data/ext/ngtcp2/tests/ngtcp2_pv_test.h +0 -35
- data/ext/ngtcp2/tests/ngtcp2_range_test.c +0 -105
- data/ext/ngtcp2/tests/ngtcp2_range_test.h +0 -36
- data/ext/ngtcp2/tests/ngtcp2_ringbuf_test.c +0 -91
- data/ext/ngtcp2/tests/ngtcp2_ringbuf_test.h +0 -35
- data/ext/ngtcp2/tests/ngtcp2_rob_test.c +0 -552
- data/ext/ngtcp2/tests/ngtcp2_rob_test.h +0 -37
- data/ext/ngtcp2/tests/ngtcp2_rtb_test.c +0 -470
- data/ext/ngtcp2/tests/ngtcp2_rtb_test.h +0 -38
- data/ext/ngtcp2/tests/ngtcp2_str_test.c +0 -96
- data/ext/ngtcp2/tests/ngtcp2_str_test.h +0 -36
- data/ext/ngtcp2/tests/ngtcp2_strm_test.c +0 -575
- data/ext/ngtcp2/tests/ngtcp2_strm_test.h +0 -36
- data/ext/ngtcp2/tests/ngtcp2_test_helper.c +0 -404
- data/ext/ngtcp2/tests/ngtcp2_test_helper.h +0 -191
- data/ext/ngtcp2/tests/ngtcp2_vec_test.c +0 -426
- data/ext/ngtcp2/tests/ngtcp2_vec_test.h +0 -36
- data/ext/ngtcp2/third-party/CMakeLists.txt +0 -34
- data/ext/ngtcp2/third-party/Makefile.am +0 -31
- data/ext/ngtcp2/third-party/http-parser/AUTHORS +0 -68
- data/ext/ngtcp2/third-party/http-parser/LICENSE-MIT +0 -23
- data/ext/ngtcp2/third-party/http-parser/Makefile +0 -157
- data/ext/ngtcp2/third-party/http-parser/README.md +0 -246
- data/ext/ngtcp2/third-party/http-parser/bench.c +0 -111
- data/ext/ngtcp2/third-party/http-parser/contrib/parsertrace.c +0 -160
- data/ext/ngtcp2/third-party/http-parser/contrib/url_parser.c +0 -47
- data/ext/ngtcp2/third-party/http-parser/http_parser.c +0 -2419
- data/ext/ngtcp2/third-party/http-parser/http_parser.gyp +0 -111
- data/ext/ngtcp2/third-party/http-parser/http_parser.h +0 -431
- data/ext/ngtcp2/third-party/http-parser/test.c +0 -4411
data/ext/ngtcp2/lib/ngtcp2_cc.c
DELETED
|
@@ -1,616 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ngtcp2
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2018 ngtcp2 contributors
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
-
* a copy of this software and associated documentation files (the
|
|
8
|
-
* "Software"), to deal in the Software without restriction, including
|
|
9
|
-
* without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
-
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
-
* permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
-
* the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be
|
|
15
|
-
* included in all copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
-
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
-
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
#include "ngtcp2_cc.h"
|
|
26
|
-
|
|
27
|
-
#include <assert.h>
|
|
28
|
-
|
|
29
|
-
#if defined(_MSC_VER)
|
|
30
|
-
# include <intrin.h>
|
|
31
|
-
#endif
|
|
32
|
-
|
|
33
|
-
#include "ngtcp2_log.h"
|
|
34
|
-
#include "ngtcp2_macro.h"
|
|
35
|
-
#include "ngtcp2_mem.h"
|
|
36
|
-
#include "ngtcp2_rcvry.h"
|
|
37
|
-
#include "ngtcp2_conn_stat.h"
|
|
38
|
-
|
|
39
|
-
uint64_t ngtcp2_cc_compute_initcwnd(size_t max_udp_payload_size) {
|
|
40
|
-
uint64_t n = 2 * max_udp_payload_size;
|
|
41
|
-
n = ngtcp2_max(n, 14720);
|
|
42
|
-
return ngtcp2_min(10 * max_udp_payload_size, n);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
ngtcp2_cc_pkt *ngtcp2_cc_pkt_init(ngtcp2_cc_pkt *pkt, int64_t pkt_num,
|
|
46
|
-
size_t pktlen, ngtcp2_pktns_id pktns_id,
|
|
47
|
-
ngtcp2_tstamp sent_ts, uint64_t lost,
|
|
48
|
-
uint64_t tx_in_flight, int is_app_limited) {
|
|
49
|
-
pkt->pkt_num = pkt_num;
|
|
50
|
-
pkt->pktlen = pktlen;
|
|
51
|
-
pkt->pktns_id = pktns_id;
|
|
52
|
-
pkt->sent_ts = sent_ts;
|
|
53
|
-
pkt->lost = lost;
|
|
54
|
-
pkt->tx_in_flight = tx_in_flight;
|
|
55
|
-
pkt->is_app_limited = is_app_limited;
|
|
56
|
-
|
|
57
|
-
return pkt;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static void reno_cc_reset(ngtcp2_reno_cc *cc) {
|
|
61
|
-
cc->max_delivery_rate_sec = 0;
|
|
62
|
-
cc->target_cwnd = 0;
|
|
63
|
-
cc->pending_add = 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
void ngtcp2_reno_cc_init(ngtcp2_reno_cc *cc, ngtcp2_log *log) {
|
|
67
|
-
cc->ccb.log = log;
|
|
68
|
-
reno_cc_reset(cc);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
void ngtcp2_reno_cc_free(ngtcp2_reno_cc *cc) { (void)cc; }
|
|
72
|
-
|
|
73
|
-
int ngtcp2_cc_reno_cc_init(ngtcp2_cc *cc, ngtcp2_log *log,
|
|
74
|
-
const ngtcp2_mem *mem) {
|
|
75
|
-
ngtcp2_reno_cc *reno_cc;
|
|
76
|
-
|
|
77
|
-
reno_cc = ngtcp2_mem_calloc(mem, 1, sizeof(ngtcp2_reno_cc));
|
|
78
|
-
if (reno_cc == NULL) {
|
|
79
|
-
return NGTCP2_ERR_NOMEM;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
ngtcp2_reno_cc_init(reno_cc, log);
|
|
83
|
-
|
|
84
|
-
cc->ccb = &reno_cc->ccb;
|
|
85
|
-
cc->on_pkt_acked = ngtcp2_cc_reno_cc_on_pkt_acked;
|
|
86
|
-
cc->congestion_event = ngtcp2_cc_reno_cc_congestion_event;
|
|
87
|
-
cc->on_persistent_congestion = ngtcp2_cc_reno_cc_on_persistent_congestion;
|
|
88
|
-
cc->on_ack_recv = ngtcp2_cc_reno_cc_on_ack_recv;
|
|
89
|
-
cc->reset = ngtcp2_cc_reno_cc_reset;
|
|
90
|
-
|
|
91
|
-
return 0;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
void ngtcp2_cc_reno_cc_free(ngtcp2_cc *cc, const ngtcp2_mem *mem) {
|
|
95
|
-
ngtcp2_reno_cc *reno_cc = ngtcp2_struct_of(cc->ccb, ngtcp2_reno_cc, ccb);
|
|
96
|
-
|
|
97
|
-
ngtcp2_reno_cc_free(reno_cc);
|
|
98
|
-
ngtcp2_mem_free(mem, reno_cc);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
static int in_congestion_recovery(const ngtcp2_conn_stat *cstat,
|
|
102
|
-
ngtcp2_tstamp sent_time) {
|
|
103
|
-
return cstat->congestion_recovery_start_ts != UINT64_MAX &&
|
|
104
|
-
sent_time <= cstat->congestion_recovery_start_ts;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
void ngtcp2_cc_reno_cc_on_pkt_acked(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
108
|
-
const ngtcp2_cc_pkt *pkt,
|
|
109
|
-
ngtcp2_tstamp ts) {
|
|
110
|
-
ngtcp2_reno_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_reno_cc, ccb);
|
|
111
|
-
uint64_t m;
|
|
112
|
-
(void)ts;
|
|
113
|
-
|
|
114
|
-
if (in_congestion_recovery(cstat, pkt->sent_ts)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (cc->target_cwnd && cc->target_cwnd < cstat->cwnd) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (cstat->cwnd < cstat->ssthresh) {
|
|
123
|
-
cstat->cwnd += pkt->pktlen;
|
|
124
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
125
|
-
"pkn=%" PRId64 " acked, slow start cwnd=%" PRIu64,
|
|
126
|
-
pkt->pkt_num, cstat->cwnd);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
m = cstat->max_tx_udp_payload_size * pkt->pktlen + cc->pending_add;
|
|
131
|
-
cc->pending_add = m % cstat->cwnd;
|
|
132
|
-
|
|
133
|
-
cstat->cwnd += m / cstat->cwnd;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
void ngtcp2_cc_reno_cc_congestion_event(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
137
|
-
ngtcp2_tstamp sent_ts,
|
|
138
|
-
ngtcp2_tstamp ts) {
|
|
139
|
-
ngtcp2_reno_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_reno_cc, ccb);
|
|
140
|
-
uint64_t min_cwnd;
|
|
141
|
-
|
|
142
|
-
if (in_congestion_recovery(cstat, sent_ts)) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
cstat->congestion_recovery_start_ts = ts;
|
|
147
|
-
cstat->cwnd >>= NGTCP2_LOSS_REDUCTION_FACTOR_BITS;
|
|
148
|
-
min_cwnd = 2 * cstat->max_tx_udp_payload_size;
|
|
149
|
-
cstat->cwnd = ngtcp2_max(cstat->cwnd, min_cwnd);
|
|
150
|
-
cstat->ssthresh = cstat->cwnd;
|
|
151
|
-
|
|
152
|
-
cc->pending_add = 0;
|
|
153
|
-
|
|
154
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
155
|
-
"reduce cwnd because of packet loss cwnd=%" PRIu64,
|
|
156
|
-
cstat->cwnd);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
void ngtcp2_cc_reno_cc_on_persistent_congestion(ngtcp2_cc *ccx,
|
|
160
|
-
ngtcp2_conn_stat *cstat,
|
|
161
|
-
ngtcp2_tstamp ts) {
|
|
162
|
-
(void)ccx;
|
|
163
|
-
(void)ts;
|
|
164
|
-
|
|
165
|
-
cstat->cwnd = 2 * cstat->max_tx_udp_payload_size;
|
|
166
|
-
cstat->congestion_recovery_start_ts = UINT64_MAX;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
void ngtcp2_cc_reno_cc_on_ack_recv(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
170
|
-
const ngtcp2_cc_ack *ack, ngtcp2_tstamp ts) {
|
|
171
|
-
ngtcp2_reno_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_reno_cc, ccb);
|
|
172
|
-
uint64_t target_cwnd, initcwnd;
|
|
173
|
-
(void)ack;
|
|
174
|
-
(void)ts;
|
|
175
|
-
|
|
176
|
-
/* TODO Use sliding window for min rtt measurement */
|
|
177
|
-
/* TODO Use sliding window */
|
|
178
|
-
cc->max_delivery_rate_sec =
|
|
179
|
-
ngtcp2_max(cc->max_delivery_rate_sec, cstat->delivery_rate_sec);
|
|
180
|
-
|
|
181
|
-
if (cstat->min_rtt != UINT64_MAX && cc->max_delivery_rate_sec) {
|
|
182
|
-
target_cwnd = cc->max_delivery_rate_sec * cstat->min_rtt / NGTCP2_SECONDS;
|
|
183
|
-
initcwnd = ngtcp2_cc_compute_initcwnd(cstat->max_tx_udp_payload_size);
|
|
184
|
-
cc->target_cwnd = ngtcp2_max(initcwnd, target_cwnd) * 289 / 100;
|
|
185
|
-
|
|
186
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
187
|
-
"target_cwnd=%" PRIu64 " max_delivery_rate_sec=%" PRIu64
|
|
188
|
-
" min_rtt=%" PRIu64,
|
|
189
|
-
cc->target_cwnd, cc->max_delivery_rate_sec, cstat->min_rtt);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
void ngtcp2_cc_reno_cc_reset(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
194
|
-
ngtcp2_tstamp ts) {
|
|
195
|
-
ngtcp2_reno_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_reno_cc, ccb);
|
|
196
|
-
(void)cstat;
|
|
197
|
-
(void)ts;
|
|
198
|
-
|
|
199
|
-
reno_cc_reset(cc);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
static void cubic_cc_reset(ngtcp2_cubic_cc *cc) {
|
|
203
|
-
cc->max_delivery_rate_sec = 0;
|
|
204
|
-
cc->target_cwnd = 0;
|
|
205
|
-
cc->w_last_max = 0;
|
|
206
|
-
cc->w_tcp = 0;
|
|
207
|
-
cc->origin_point = 0;
|
|
208
|
-
cc->epoch_start = UINT64_MAX;
|
|
209
|
-
cc->k = 0;
|
|
210
|
-
|
|
211
|
-
cc->prior.cwnd = 0;
|
|
212
|
-
cc->prior.ssthresh = 0;
|
|
213
|
-
cc->prior.w_last_max = 0;
|
|
214
|
-
cc->prior.w_tcp = 0;
|
|
215
|
-
cc->prior.origin_point = 0;
|
|
216
|
-
cc->prior.epoch_start = UINT64_MAX;
|
|
217
|
-
cc->prior.k = 0;
|
|
218
|
-
|
|
219
|
-
cc->rtt_sample_count = 0;
|
|
220
|
-
cc->current_round_min_rtt = UINT64_MAX;
|
|
221
|
-
cc->last_round_min_rtt = UINT64_MAX;
|
|
222
|
-
cc->window_end = -1;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
void ngtcp2_cubic_cc_init(ngtcp2_cubic_cc *cc, ngtcp2_log *log) {
|
|
226
|
-
cc->ccb.log = log;
|
|
227
|
-
cubic_cc_reset(cc);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
void ngtcp2_cubic_cc_free(ngtcp2_cubic_cc *cc) { (void)cc; }
|
|
231
|
-
|
|
232
|
-
int ngtcp2_cc_cubic_cc_init(ngtcp2_cc *cc, ngtcp2_log *log,
|
|
233
|
-
const ngtcp2_mem *mem) {
|
|
234
|
-
ngtcp2_cubic_cc *cubic_cc;
|
|
235
|
-
|
|
236
|
-
cubic_cc = ngtcp2_mem_calloc(mem, 1, sizeof(ngtcp2_cubic_cc));
|
|
237
|
-
if (cubic_cc == NULL) {
|
|
238
|
-
return NGTCP2_ERR_NOMEM;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
ngtcp2_cubic_cc_init(cubic_cc, log);
|
|
242
|
-
|
|
243
|
-
cc->ccb = &cubic_cc->ccb;
|
|
244
|
-
cc->on_pkt_acked = ngtcp2_cc_cubic_cc_on_pkt_acked;
|
|
245
|
-
cc->congestion_event = ngtcp2_cc_cubic_cc_congestion_event;
|
|
246
|
-
cc->on_spurious_congestion = ngtcp2_cc_cubic_cc_on_spurious_congestion;
|
|
247
|
-
cc->on_persistent_congestion = ngtcp2_cc_cubic_cc_on_persistent_congestion;
|
|
248
|
-
cc->on_ack_recv = ngtcp2_cc_cubic_cc_on_ack_recv;
|
|
249
|
-
cc->on_pkt_sent = ngtcp2_cc_cubic_cc_on_pkt_sent;
|
|
250
|
-
cc->new_rtt_sample = ngtcp2_cc_cubic_cc_new_rtt_sample;
|
|
251
|
-
cc->reset = ngtcp2_cc_cubic_cc_reset;
|
|
252
|
-
cc->event = ngtcp2_cc_cubic_cc_event;
|
|
253
|
-
|
|
254
|
-
return 0;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
void ngtcp2_cc_cubic_cc_free(ngtcp2_cc *cc, const ngtcp2_mem *mem) {
|
|
258
|
-
ngtcp2_cubic_cc *cubic_cc = ngtcp2_struct_of(cc->ccb, ngtcp2_cubic_cc, ccb);
|
|
259
|
-
|
|
260
|
-
ngtcp2_cubic_cc_free(cubic_cc);
|
|
261
|
-
ngtcp2_mem_free(mem, cubic_cc);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
static uint64_t ngtcp2_cbrt(uint64_t n) {
|
|
265
|
-
int d;
|
|
266
|
-
uint64_t a;
|
|
267
|
-
|
|
268
|
-
if (n == 0) {
|
|
269
|
-
return 0;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
#if defined(_MSC_VER)
|
|
273
|
-
# if defined(_M_X64)
|
|
274
|
-
d = (int)__lzcnt64(n);
|
|
275
|
-
# elif defined(_M_ARM64)
|
|
276
|
-
{
|
|
277
|
-
unsigned long index;
|
|
278
|
-
d = sizeof(uint64_t) * CHAR_BIT;
|
|
279
|
-
if (_BitScanReverse64(&index, n)) {
|
|
280
|
-
d = d - 1 - index;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
# else
|
|
284
|
-
if ((n >> 32) != 0) {
|
|
285
|
-
d = __lzcnt((unsigned int)(n >> 32));
|
|
286
|
-
} else {
|
|
287
|
-
d = 32 + __lzcnt((unsigned int)n);
|
|
288
|
-
}
|
|
289
|
-
# endif
|
|
290
|
-
#else
|
|
291
|
-
d = __builtin_clzll(n);
|
|
292
|
-
#endif
|
|
293
|
-
a = 1ULL << ((64 - d) / 3 + 1);
|
|
294
|
-
|
|
295
|
-
for (; a * a * a > n;) {
|
|
296
|
-
a = (2 * a + n / a / a) / 3;
|
|
297
|
-
}
|
|
298
|
-
return a;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/* HyStart++ constants */
|
|
302
|
-
#define NGTCP2_HS_MIN_SSTHRESH 16
|
|
303
|
-
#define NGTCP2_HS_N_RTT_SAMPLE 8
|
|
304
|
-
#define NGTCP2_HS_MIN_ETA (4 * NGTCP2_MILLISECONDS)
|
|
305
|
-
#define NGTCP2_HS_MAX_ETA (16 * NGTCP2_MILLISECONDS)
|
|
306
|
-
|
|
307
|
-
void ngtcp2_cc_cubic_cc_on_pkt_acked(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
308
|
-
const ngtcp2_cc_pkt *pkt,
|
|
309
|
-
ngtcp2_tstamp ts) {
|
|
310
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
311
|
-
ngtcp2_duration t, eta;
|
|
312
|
-
uint64_t target, cwnd_thres;
|
|
313
|
-
uint64_t tx, kx, time_delta, delta;
|
|
314
|
-
uint64_t add, tcp_add;
|
|
315
|
-
uint64_t m;
|
|
316
|
-
|
|
317
|
-
if (pkt->pktns_id == NGTCP2_PKTNS_ID_APPLICATION && cc->window_end != -1 &&
|
|
318
|
-
cc->window_end <= pkt->pkt_num) {
|
|
319
|
-
cc->window_end = -1;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (in_congestion_recovery(cstat, pkt->sent_ts)) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (cc->target_cwnd && cc->target_cwnd < cstat->cwnd) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (cstat->cwnd < cstat->ssthresh) {
|
|
331
|
-
/* slow-start */
|
|
332
|
-
cstat->cwnd += pkt->pktlen;
|
|
333
|
-
|
|
334
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
335
|
-
"pkn=%" PRId64 " acked, slow start cwnd=%" PRIu64,
|
|
336
|
-
pkt->pkt_num, cstat->cwnd);
|
|
337
|
-
|
|
338
|
-
if (cc->last_round_min_rtt != UINT64_MAX &&
|
|
339
|
-
cc->current_round_min_rtt != UINT64_MAX &&
|
|
340
|
-
cstat->cwnd >=
|
|
341
|
-
NGTCP2_HS_MIN_SSTHRESH * cstat->max_tx_udp_payload_size &&
|
|
342
|
-
cc->rtt_sample_count >= NGTCP2_HS_N_RTT_SAMPLE) {
|
|
343
|
-
eta = cc->last_round_min_rtt / 8;
|
|
344
|
-
|
|
345
|
-
if (eta < NGTCP2_HS_MIN_ETA) {
|
|
346
|
-
eta = NGTCP2_HS_MIN_ETA;
|
|
347
|
-
} else if (eta > NGTCP2_HS_MAX_ETA) {
|
|
348
|
-
eta = NGTCP2_HS_MAX_ETA;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (cc->current_round_min_rtt >= cc->last_round_min_rtt + eta) {
|
|
352
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
353
|
-
"HyStart++ exit slow start");
|
|
354
|
-
|
|
355
|
-
cc->w_last_max = cstat->cwnd;
|
|
356
|
-
cstat->ssthresh = cstat->cwnd;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/* congestion avoidance */
|
|
364
|
-
|
|
365
|
-
if (cc->epoch_start == UINT64_MAX) {
|
|
366
|
-
cc->epoch_start = ts;
|
|
367
|
-
if (cstat->cwnd < cc->w_last_max) {
|
|
368
|
-
cc->k = ngtcp2_cbrt((cc->w_last_max - cstat->cwnd) * 10 / 4 /
|
|
369
|
-
cstat->max_tx_udp_payload_size);
|
|
370
|
-
cc->origin_point = cc->w_last_max;
|
|
371
|
-
} else {
|
|
372
|
-
cc->k = 0;
|
|
373
|
-
cc->origin_point = cstat->cwnd;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
cc->w_tcp = cstat->cwnd;
|
|
377
|
-
|
|
378
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
379
|
-
"cubic-ca epoch_start=%" PRIu64 " k=%" PRIu64
|
|
380
|
-
" origin_point=%" PRIu64,
|
|
381
|
-
cc->epoch_start, cc->k, cc->origin_point);
|
|
382
|
-
|
|
383
|
-
cc->pending_add = 0;
|
|
384
|
-
cc->pending_w_add = 0;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
t = ts - cc->epoch_start;
|
|
388
|
-
|
|
389
|
-
tx = (t << 10) / NGTCP2_SECONDS;
|
|
390
|
-
kx = (cc->k << 10);
|
|
391
|
-
|
|
392
|
-
if (tx > kx) {
|
|
393
|
-
time_delta = tx - kx;
|
|
394
|
-
} else {
|
|
395
|
-
time_delta = kx - tx;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
delta = cstat->max_tx_udp_payload_size *
|
|
399
|
-
((((time_delta * time_delta) >> 10) * time_delta) >> 10) * 4 / 10;
|
|
400
|
-
delta >>= 10;
|
|
401
|
-
|
|
402
|
-
if (tx > kx) {
|
|
403
|
-
target = cc->origin_point + delta;
|
|
404
|
-
} else {
|
|
405
|
-
target = cc->origin_point - delta;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
cwnd_thres =
|
|
409
|
-
(target * (((t + cstat->smoothed_rtt) << 10) / NGTCP2_SECONDS)) >> 10;
|
|
410
|
-
if (cwnd_thres < cstat->cwnd) {
|
|
411
|
-
target = cstat->cwnd;
|
|
412
|
-
} else if (2 * cwnd_thres > 3 * cstat->cwnd) {
|
|
413
|
-
target = cstat->cwnd * 3 / 2;
|
|
414
|
-
} else {
|
|
415
|
-
target = cwnd_thres;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (target > cstat->cwnd) {
|
|
419
|
-
m = cc->pending_add +
|
|
420
|
-
cstat->max_tx_udp_payload_size * (target - cstat->cwnd);
|
|
421
|
-
add = m / cstat->cwnd;
|
|
422
|
-
cc->pending_add = m % cstat->cwnd;
|
|
423
|
-
} else {
|
|
424
|
-
m = cc->pending_add + cstat->max_tx_udp_payload_size;
|
|
425
|
-
add = m / (100 * cstat->cwnd);
|
|
426
|
-
cc->pending_add = m % (100 * cstat->cwnd);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
m = cc->pending_w_add + cstat->max_tx_udp_payload_size * pkt->pktlen;
|
|
430
|
-
|
|
431
|
-
cc->w_tcp += m / cstat->cwnd;
|
|
432
|
-
cc->pending_w_add = m % cstat->cwnd;
|
|
433
|
-
|
|
434
|
-
if (cc->w_tcp > cstat->cwnd) {
|
|
435
|
-
tcp_add = cstat->max_tx_udp_payload_size * (cc->w_tcp - cstat->cwnd) /
|
|
436
|
-
cstat->cwnd;
|
|
437
|
-
if (tcp_add > add) {
|
|
438
|
-
add = tcp_add;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
cstat->cwnd += add;
|
|
443
|
-
|
|
444
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
445
|
-
"pkn=%" PRId64 " acked, cubic-ca cwnd=%" PRIu64 " t=%" PRIu64
|
|
446
|
-
" k=%" PRIi64 " time_delta=%" PRIu64 " delta=%" PRIu64
|
|
447
|
-
" target=%" PRIu64 " w_tcp=%" PRIu64,
|
|
448
|
-
pkt->pkt_num, cstat->cwnd, t, cc->k, time_delta >> 4, delta,
|
|
449
|
-
target, cc->w_tcp);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
void ngtcp2_cc_cubic_cc_congestion_event(ngtcp2_cc *ccx,
|
|
453
|
-
ngtcp2_conn_stat *cstat,
|
|
454
|
-
ngtcp2_tstamp sent_ts,
|
|
455
|
-
ngtcp2_tstamp ts) {
|
|
456
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
457
|
-
uint64_t min_cwnd;
|
|
458
|
-
|
|
459
|
-
if (in_congestion_recovery(cstat, sent_ts)) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
if (cc->prior.cwnd < cstat->cwnd) {
|
|
464
|
-
cc->prior.cwnd = cstat->cwnd;
|
|
465
|
-
cc->prior.ssthresh = cstat->ssthresh;
|
|
466
|
-
cc->prior.w_last_max = cc->w_last_max;
|
|
467
|
-
cc->prior.w_tcp = cc->w_tcp;
|
|
468
|
-
cc->prior.origin_point = cc->origin_point;
|
|
469
|
-
cc->prior.epoch_start = cc->epoch_start;
|
|
470
|
-
cc->prior.k = cc->k;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
cstat->congestion_recovery_start_ts = ts;
|
|
474
|
-
|
|
475
|
-
cc->epoch_start = UINT64_MAX;
|
|
476
|
-
if (cstat->cwnd < cc->w_last_max) {
|
|
477
|
-
cc->w_last_max = cstat->cwnd * 17 / 10 / 2;
|
|
478
|
-
} else {
|
|
479
|
-
cc->w_last_max = cstat->cwnd;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
min_cwnd = 2 * cstat->max_tx_udp_payload_size;
|
|
483
|
-
cstat->ssthresh = cstat->cwnd * 7 / 10;
|
|
484
|
-
cstat->ssthresh = ngtcp2_max(cstat->ssthresh, min_cwnd);
|
|
485
|
-
cstat->cwnd = cstat->ssthresh;
|
|
486
|
-
|
|
487
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
488
|
-
"reduce cwnd because of packet loss cwnd=%" PRIu64,
|
|
489
|
-
cstat->cwnd);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
void ngtcp2_cc_cubic_cc_on_spurious_congestion(ngtcp2_cc *ccx,
|
|
493
|
-
ngtcp2_conn_stat *cstat,
|
|
494
|
-
ngtcp2_tstamp ts) {
|
|
495
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
496
|
-
(void)ts;
|
|
497
|
-
|
|
498
|
-
if (cstat->cwnd >= cc->prior.cwnd) {
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
cstat->congestion_recovery_start_ts = UINT64_MAX;
|
|
503
|
-
|
|
504
|
-
cstat->cwnd = cc->prior.cwnd;
|
|
505
|
-
cstat->ssthresh = cc->prior.ssthresh;
|
|
506
|
-
cc->w_last_max = cc->prior.w_last_max;
|
|
507
|
-
cc->w_tcp = cc->prior.w_tcp;
|
|
508
|
-
cc->origin_point = cc->prior.origin_point;
|
|
509
|
-
cc->epoch_start = cc->prior.epoch_start;
|
|
510
|
-
cc->k = cc->prior.k;
|
|
511
|
-
|
|
512
|
-
cc->prior.cwnd = 0;
|
|
513
|
-
cc->prior.ssthresh = 0;
|
|
514
|
-
cc->prior.w_last_max = 0;
|
|
515
|
-
cc->prior.w_tcp = 0;
|
|
516
|
-
cc->prior.origin_point = 0;
|
|
517
|
-
cc->prior.epoch_start = UINT64_MAX;
|
|
518
|
-
cc->prior.k = 0;
|
|
519
|
-
|
|
520
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
521
|
-
"spurious congestion is detected and congestion state is "
|
|
522
|
-
"restored cwnd=%" PRIu64,
|
|
523
|
-
cstat->cwnd);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
void ngtcp2_cc_cubic_cc_on_persistent_congestion(ngtcp2_cc *ccx,
|
|
527
|
-
ngtcp2_conn_stat *cstat,
|
|
528
|
-
ngtcp2_tstamp ts) {
|
|
529
|
-
(void)ccx;
|
|
530
|
-
(void)ts;
|
|
531
|
-
|
|
532
|
-
cstat->cwnd = 2 * cstat->max_tx_udp_payload_size;
|
|
533
|
-
cstat->congestion_recovery_start_ts = UINT64_MAX;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
void ngtcp2_cc_cubic_cc_on_ack_recv(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
537
|
-
const ngtcp2_cc_ack *ack,
|
|
538
|
-
ngtcp2_tstamp ts) {
|
|
539
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
540
|
-
uint64_t target_cwnd, initcwnd;
|
|
541
|
-
(void)ack;
|
|
542
|
-
(void)ts;
|
|
543
|
-
|
|
544
|
-
/* TODO Use sliding window for min rtt measurement */
|
|
545
|
-
/* TODO Use sliding window */
|
|
546
|
-
cc->max_delivery_rate_sec =
|
|
547
|
-
ngtcp2_max(cc->max_delivery_rate_sec, cstat->delivery_rate_sec);
|
|
548
|
-
|
|
549
|
-
if (cstat->min_rtt != UINT64_MAX && cc->max_delivery_rate_sec) {
|
|
550
|
-
target_cwnd = cc->max_delivery_rate_sec * cstat->min_rtt / NGTCP2_SECONDS;
|
|
551
|
-
initcwnd = ngtcp2_cc_compute_initcwnd(cstat->max_tx_udp_payload_size);
|
|
552
|
-
cc->target_cwnd = ngtcp2_max(initcwnd, target_cwnd) * 289 / 100;
|
|
553
|
-
|
|
554
|
-
ngtcp2_log_info(cc->ccb.log, NGTCP2_LOG_EVENT_RCV,
|
|
555
|
-
"target_cwnd=%" PRIu64 " max_delivery_rate_sec=%" PRIu64
|
|
556
|
-
" min_rtt=%" PRIu64,
|
|
557
|
-
cc->target_cwnd, cc->max_delivery_rate_sec, cstat->min_rtt);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
void ngtcp2_cc_cubic_cc_on_pkt_sent(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
562
|
-
const ngtcp2_cc_pkt *pkt) {
|
|
563
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
564
|
-
(void)cstat;
|
|
565
|
-
|
|
566
|
-
if (pkt->pktns_id != NGTCP2_PKTNS_ID_APPLICATION || cc->window_end != -1) {
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
cc->window_end = pkt->pkt_num;
|
|
571
|
-
cc->last_round_min_rtt = cc->current_round_min_rtt;
|
|
572
|
-
cc->current_round_min_rtt = UINT64_MAX;
|
|
573
|
-
cc->rtt_sample_count = 0;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
void ngtcp2_cc_cubic_cc_new_rtt_sample(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
577
|
-
ngtcp2_tstamp ts) {
|
|
578
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
579
|
-
(void)ts;
|
|
580
|
-
|
|
581
|
-
if (cc->window_end == -1) {
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
cc->current_round_min_rtt =
|
|
586
|
-
ngtcp2_min(cc->current_round_min_rtt, cstat->latest_rtt);
|
|
587
|
-
++cc->rtt_sample_count;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
void ngtcp2_cc_cubic_cc_reset(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
591
|
-
ngtcp2_tstamp ts) {
|
|
592
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
593
|
-
(void)cstat;
|
|
594
|
-
(void)ts;
|
|
595
|
-
|
|
596
|
-
cubic_cc_reset(cc);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
void ngtcp2_cc_cubic_cc_event(ngtcp2_cc *ccx, ngtcp2_conn_stat *cstat,
|
|
600
|
-
ngtcp2_cc_event_type event, ngtcp2_tstamp ts) {
|
|
601
|
-
ngtcp2_cubic_cc *cc = ngtcp2_struct_of(ccx->ccb, ngtcp2_cubic_cc, ccb);
|
|
602
|
-
ngtcp2_tstamp last_ts;
|
|
603
|
-
|
|
604
|
-
if (event != NGTCP2_CC_EVENT_TYPE_TX_START || cc->epoch_start == UINT64_MAX) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
last_ts = cstat->last_tx_pkt_ts[NGTCP2_PKTNS_ID_APPLICATION];
|
|
609
|
-
if (last_ts == UINT64_MAX || last_ts <= cc->epoch_start) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
assert(ts >= last_ts);
|
|
614
|
-
|
|
615
|
-
cc->epoch_start += ts - last_ts;
|
|
616
|
-
}
|