From a94fda0ea27a13a1d9c339a91268624d18ecc8c1 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 19 Feb 2021 12:38:07 +0100 Subject: [PATCH] Add QUICHE_ERR_STREAM_STOPPED error (#194) Motivation: Quiche 0.7.0 added QUICHE_ERR_STREAM_STOPPED, we need to handle it Modifications: Add missing QUICHE_ERR_STREAM_STOPPED handling Result: All errors are correctly converted --- src/main/c/netty_quic_quiche.c | 5 +++++ src/main/java/io/netty/incubator/codec/quic/QuicError.java | 3 ++- src/main/java/io/netty/incubator/codec/quic/Quiche.java | 7 +++++++ .../quic/QuicheNativeStaticallyReferencedJniMethods.java | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/c/netty_quic_quiche.c b/src/main/c/netty_quic_quiche.c index d69b3f5c6..50a21c580 100644 --- a/src/main/c/netty_quic_quiche.c +++ b/src/main/c/netty_quic_quiche.c @@ -110,6 +110,10 @@ static jint netty_quiche_err_final_size(JNIEnv* env, jclass clazz) { return QUICHE_ERR_FINAL_SIZE; } +static jint netty_quiche_err_stream_stopped(JNIEnv* env, jclass clazz) { + return QUICHE_ERR_STREAM_STOPPED; +} + static jint netty_quiche_err_congestion_control(JNIEnv* env, jclass clazz) { return QUICHE_ERR_CONGESTION_CONTROL; } @@ -435,6 +439,7 @@ static const JNINativeMethod statically_referenced_fixed_method_table[] = { { "quiche_err_flow_control", "()I", (void *) netty_quiche_err_flow_control }, { "quiche_err_stream_limit", "()I", (void *) netty_quiche_err_stream_limit }, { "quiche_err_final_size", "()I", (void *) netty_quiche_err_final_size }, + { "quiche_err_stream_stopped", "()I", (void *) netty_quiche_err_stream_stopped }, { "quiche_err_congestion_control", "()I", (void *) netty_quiche_err_congestion_control }, { "quiche_cc_reno", "()I", (void *) netty_quiche_cc_reno }, { "quiche_cc_cubic", "()I", (void *) netty_quiche_cc_cubic } diff --git a/src/main/java/io/netty/incubator/codec/quic/QuicError.java b/src/main/java/io/netty/incubator/codec/quic/QuicError.java index 22e55ab66..6d73b948b 100644 --- a/src/main/java/io/netty/incubator/codec/quic/QuicError.java +++ b/src/main/java/io/netty/incubator/codec/quic/QuicError.java @@ -35,7 +35,8 @@ public enum QuicError { FLOW_CONTROL(Quiche.QUICHE_ERR_FLOW_CONTROL, "QUICHE_ERR_FLOW_CONTROL"), STREAM_LIMIT(Quiche.QUICHE_ERR_STREAM_LIMIT, "QUICHE_ERR_STREAM_LIMIT"), FINAL_SIZE(Quiche.QUICHE_ERR_FINAL_SIZE, "QUICHE_ERR_FINAL_SIZE"), - CONGESTION_CONTROL(Quiche.QUICHE_ERR_CONGESTION_CONTROL, "QUICHE_ERR_CONGESTION_CONTROL"); + CONGESTION_CONTROL(Quiche.QUICHE_ERR_CONGESTION_CONTROL, "QUICHE_ERR_CONGESTION_CONTROL"), + STREAM_STOPPED(Quiche.QUICHE_ERR_STREAM_STOPPED, "STREAM_STOPPED"); private static final IntObjectMap ERROR_MAP = new IntObjectHashMap<>(); diff --git a/src/main/java/io/netty/incubator/codec/quic/Quiche.java b/src/main/java/io/netty/incubator/codec/quic/Quiche.java index f590c910b..407c649fe 100644 --- a/src/main/java/io/netty/incubator/codec/quic/Quiche.java +++ b/src/main/java/io/netty/incubator/codec/quic/Quiche.java @@ -162,6 +162,13 @@ private static void loadNativeLibrary() { static final int QUICHE_ERR_CONGESTION_CONTROL = QuicheNativeStaticallyReferencedJniMethods.quiche_err_congestion_control(); + /** + * See + * QUICHE_ERR_STREAM_STOPPED. + */ + static final int QUICHE_ERR_STREAM_STOPPED = + QuicheNativeStaticallyReferencedJniMethods.quiche_err_stream_stopped(); + /** * See * QUICHE_CC_RENO. diff --git a/src/main/java/io/netty/incubator/codec/quic/QuicheNativeStaticallyReferencedJniMethods.java b/src/main/java/io/netty/incubator/codec/quic/QuicheNativeStaticallyReferencedJniMethods.java index b9a0482cc..b7e70297a 100644 --- a/src/main/java/io/netty/incubator/codec/quic/QuicheNativeStaticallyReferencedJniMethods.java +++ b/src/main/java/io/netty/incubator/codec/quic/QuicheNativeStaticallyReferencedJniMethods.java @@ -35,6 +35,7 @@ final class QuicheNativeStaticallyReferencedJniMethods { static native int quiche_err_flow_control(); static native int quiche_err_stream_limit(); static native int quiche_err_final_size(); + static native int quiche_err_stream_stopped(); static native int quiche_err_congestion_control(); static native int quiche_cc_reno();