Skip to content

Commit

Permalink
Add QUICHE_ERR_STREAM_STOPPED error (java-native-access#194)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
normanmaurer authored Feb 19, 2021
1 parent e715c0a commit a94fda0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/c/netty_quic_quiche.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 }
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/netty/incubator/codec/quic/QuicError.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<QuicError> ERROR_MAP = new IntObjectHashMap<>();

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/io/netty/incubator/codec/quic/Quiche.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ private static void loadNativeLibrary() {
static final int QUICHE_ERR_CONGESTION_CONTROL =
QuicheNativeStaticallyReferencedJniMethods.quiche_err_congestion_control();

/**
* See <a href="https://github.com/cloudflare/quiche/blob/0.7.0/include/quiche.h#L98">
* QUICHE_ERR_STREAM_STOPPED</a>.
*/
static final int QUICHE_ERR_STREAM_STOPPED =
QuicheNativeStaticallyReferencedJniMethods.quiche_err_stream_stopped();

/**
* See <a href="https://github.com/cloudflare/quiche/blob/0.6.0/include/quiche.h#L176">
* QUICHE_CC_RENO</a>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a94fda0

Please sign in to comment.