From bdadcb839cab9288342f78a93efaff6f3741d9fe Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 20 Oct 2023 12:16:42 +0200 Subject: [PATCH] Update to latest quiche sha (#596) Motivation: Let's update to latest quiche sha. Modifications: - Update to latest quiche sha - Fix QuicConnectionStats to be able to compile against latest sha Result: Use latest quiche code --- .../codec/quic/QuicConnectionStats.java | 68 +--------------- .../codec/quic/QuicheQuicConnectionStats.java | 78 ------------------- codec-native-quic/pom.xml | 2 +- .../src/main/c/netty_quic_quiche.c | 21 +---- 4 files changed, 7 insertions(+), 162 deletions(-) diff --git a/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicConnectionStats.java b/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicConnectionStats.java index 0e9bc2750..d6e094f22 100644 --- a/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicConnectionStats.java +++ b/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicConnectionStats.java @@ -16,7 +16,8 @@ package io.netty.incubator.codec.quic; /** - * Statistics about the {@code QUIC} connection. + * Statistics about the {@code QUIC} connection. If unknown by the implementation it might return {@code -1} values + * for the various methods. */ public interface QuicConnectionStats { /** @@ -63,69 +64,4 @@ public interface QuicConnectionStats { * @return The number of known paths for the connection. */ long pathsCount(); - - /** - * @return The maximum idle timeout. - */ - long peerMaxIdleTimeout(); - - /** - * @return The maximum UDP payload size. - */ - long peerMaxUdpPayloadSize(); - - /** - * @return The initial flow control maximum data for the connection. - */ - long peerInitialMaxData(); - - /** - * @return The initial flow control maximum data for local bidirectional streams. - */ - long peerInitialMaxStreamDataBidiLocal(); - - /** - * @return The initial flow control maximum data for remote bidirectional streams. - */ - long peerInitialMaxStreamDataBidiRemote(); - - /** - * @return The initial flow control maximum data for unidirectional streams. - */ - long peerInitialMaxStreamDataUni(); - - /** - * @return The initial maximum bidirectional streams. - */ - long peerInitialMaxStreamsBidi(); - - /** - * @return The initial maximum unidirectional streams. - */ - long peerInitialMaxStreamsUni(); - - /** - * @return The ACK delay exponent. - */ - long peerAckDelayExponent(); - - /** - * @return The max ACK delay. - */ - long peerMaxAckDelay(); - - /** - * @return Whether active migration is disabled. - */ - boolean peerDisableActiveMigration(); - - /** - * @return The active connection ID limit. - */ - long peerActiveConnIdLimit(); - - /** - * @return DATAGRAM frame extension parameter, if any. - */ - long peerMaxDatagramFrameSize(); } diff --git a/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicheQuicConnectionStats.java b/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicheQuicConnectionStats.java index 5a3c10452..489c3f64b 100644 --- a/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicheQuicConnectionStats.java +++ b/codec-classes-quic/src/main/java/io/netty/incubator/codec/quic/QuicheQuicConnectionStats.java @@ -70,71 +70,6 @@ public long pathsCount() { return values[8]; } - @Override - public long peerMaxIdleTimeout() { - return values[9]; - } - - @Override - public long peerMaxUdpPayloadSize() { - return values[10]; - } - - @Override - public long peerInitialMaxData() { - return values[11]; - } - - @Override - public long peerInitialMaxStreamDataBidiLocal() { - return values[12]; - } - - @Override - public long peerInitialMaxStreamDataBidiRemote() { - return values[13]; - } - - @Override - public long peerInitialMaxStreamDataUni() { - return values[14]; - } - - @Override - public long peerInitialMaxStreamsBidi() { - return values[15]; - } - - @Override - public long peerInitialMaxStreamsUni() { - return values[16]; - } - - @Override - public long peerAckDelayExponent() { - return values[17]; - } - - @Override - public long peerMaxAckDelay() { - return values[18]; - } - - @Override - public boolean peerDisableActiveMigration() { - return values[19] == 1; - } - - @Override - public long peerActiveConnIdLimit() { - return values[20]; - } - - @Override - public long peerMaxDatagramFrameSize() { - return values[21]; - } - /** * Returns the {@link String} representation of stats. */ @@ -150,19 +85,6 @@ public String toString() { ", lostBytes=" + lostBytes() + ", streamRetransBytes=" + streamRetransBytes() + ", pathsCount=" + pathsCount() + - ", peerMaxIdleTimeout=" + peerMaxIdleTimeout() + - ", peerMaxUdpPayloadSize=" + peerMaxUdpPayloadSize() + - ", peerInitialMaxData=" + peerInitialMaxData() + - ", peerInitialMaxStreamDataBidiLocal=" + peerInitialMaxStreamDataBidiLocal() + - ", peerInitialMaxStreamDataBidiRemote=" + peerInitialMaxStreamDataBidiRemote() + - ", peerInitialMaxStreamDataUni=" + peerInitialMaxStreamDataUni() + - ", peerInitialMaxStreamsBidi=" + peerInitialMaxStreamsBidi() + - ", peerInitialMaxStreamsUni=" + peerInitialMaxStreamsUni() + - ", peerAckDelayExponent=" + peerAckDelayExponent() + - ", peerMaxAckDelay=" + peerMaxAckDelay() + - ", peerDisableActiveMigration=" + peerDisableActiveMigration() + - ", peerActiveConnIdLimit=" + peerActiveConnIdLimit() + - ", peerMaxDatagramFrameSize=" + peerMaxDatagramFrameSize() + "]"; } diff --git a/codec-native-quic/pom.xml b/codec-native-quic/pom.xml index b13e9d238..47fbd701c 100644 --- a/codec-native-quic/pom.xml +++ b/codec-native-quic/pom.xml @@ -56,7 +56,7 @@ ${quicheHomeDir}/quiche/include https://github.com/cloudflare/quiche master - 28ef289f027713cb024e3171ccfa2972fc12a9e2 + 83d9168ab6f76302ae846cb068cc8991f2b06479 ${project.build.directory}/generated-sources ${project.build.directory}/template diff --git a/codec-native-quic/src/main/c/netty_quic_quiche.c b/codec-native-quic/src/main/c/netty_quic_quiche.c index 24f4a6949..7f8fa31a0 100644 --- a/codec-native-quic/src/main/c/netty_quic_quiche.c +++ b/codec-native-quic/src/main/c/netty_quic_quiche.c @@ -495,10 +495,10 @@ static jboolean netty_quiche_conn_is_timed_out(JNIEnv* env, jclass clazz, jlong static jlongArray netty_quiche_conn_stats(JNIEnv* env, jclass clazz, jlong conn) { // See https://github.com/cloudflare/quiche/blob/master/quiche/include/quiche.h#L467 - quiche_stats stats = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,true,0,0}; + quiche_stats stats = {0,0,0,0,0,0,0,0,0}; quiche_conn_stats((quiche_conn *) conn, &stats); - jlongArray statsArray = (*env)->NewLongArray(env, 22); + jlongArray statsArray = (*env)->NewLongArray(env, 9); if (statsArray == NULL) { // This will put an OOME on the stack return NULL; @@ -512,22 +512,9 @@ static jlongArray netty_quiche_conn_stats(JNIEnv* env, jclass clazz, jlong conn) (jlong)stats.recv_bytes, (jlong)stats.lost_bytes, (jlong)stats.stream_retrans_bytes, - (jlong)stats.paths_count, - (jlong)stats.peer_max_idle_timeout, - (jlong)stats.peer_max_udp_payload_size, - (jlong)stats.peer_initial_max_data, - (jlong)stats.peer_initial_max_stream_data_bidi_local, - (jlong)stats.peer_initial_max_stream_data_bidi_remote, - (jlong)stats.peer_initial_max_stream_data_uni, - (jlong)stats.peer_initial_max_streams_bidi, - (jlong)stats.peer_initial_max_streams_uni, - (jlong)stats.peer_ack_delay_exponent, - (jlong)stats.peer_max_ack_delay, - stats.peer_disable_active_migration ? 1 : 0, - (jlong)stats.peer_active_conn_id_limit, - (jlong)stats.peer_max_datagram_frame_size, + (jlong)stats.paths_count }; - (*env)->SetLongArrayRegion(env, statsArray, 0, 22, statsArrayElements); + (*env)->SetLongArrayRegion(env, statsArray, 0, 9, statsArrayElements); return statsArray; }