Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust API usage to match latest quiche code #624

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static native int quiche_conn_stream_priority(

static native int quiche_conn_scids_left(long connAddr);

static native long quiche_conn_new_scid(long connAddr, long scidAddr, int scidLen, byte[] resetToken, boolean retire_if_needed);
static native long quiche_conn_new_scid(long connAddr, long scidAddr, int scidLen, byte[] resetToken, boolean retire_if_needed, long seq);

static native byte[] quiche_conn_retired_scid_next(long connAddr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,11 @@ List<ByteBuffer> newSourceConnectionIds(
boolean sendAndFlush = false;
ByteBuffer key = localIdAdrr.connId.duplicate();
ByteBuf connIdBuffer = alloc().directBuffer(key.remaining());
ByteBuf seqBuffer = alloc().directBuffer(Long.BYTES);

byte[] resetTokenArray = new byte[Quic.RESET_TOKEN_LEN];
try {
long seqAddress = Quiche.memoryAddress(seqBuffer, 0, seqBuffer.capacity());
do {
ByteBuffer srcId = connectionIdGenerator.newId(key, key.remaining());
connIdBuffer.clear();
Expand All @@ -927,7 +929,7 @@ List<ByteBuffer> newSourceConnectionIds(
resetToken.get(resetTokenArray);
long result = Quiche.quiche_conn_new_scid(
connAddr, Quiche.memoryAddress(connIdBuffer, 0, connIdBuffer.readableBytes()),
connIdBuffer.readableBytes(), resetTokenArray, false);
connIdBuffer.readableBytes(), resetTokenArray, false, seqAddress);
if (result < 0) {
break;
}
Expand All @@ -937,6 +939,7 @@ List<ByteBuffer> newSourceConnectionIds(
} while (--left > 0);
} finally {
connIdBuffer.release();
seqBuffer.release();
}

if (sendAndFlush) {
Expand Down
2 changes: 1 addition & 1 deletion codec-native-quic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<quicheHomeIncludeDir>${quicheHomeDir}/quiche/include</quicheHomeIncludeDir>
<quicheRepository>https://github.com/cloudflare/quiche</quicheRepository>
<quicheBranch>master</quicheBranch>
<quicheCommitSha>5796adc0a06044e9e4f2020ad51f680bd0d071bc</quicheCommitSha>
<quicheCommitSha>b0944d88882e412685554446e6209c317b6f912b</quicheCommitSha>
<generatedSourcesDir>${project.build.directory}/generated-sources</generatedSourcesDir>
<templateDir>${project.build.directory}/template</templateDir>
<cargoTarget />
Expand Down
6 changes: 3 additions & 3 deletions codec-native-quic/src/main/c/netty_quic_quiche.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,9 @@ static jint netty_quiche_conn_scids_left(JNIEnv* env, jclass clazz, jlong conn)
return (jint) quiche_conn_scids_left((quiche_conn *) conn);
}

static jlong netty_quiche_conn_new_scid(JNIEnv* env, jclass clazz, jlong conn, jlong scid, jint scid_len, jbyteArray reset_token, jboolean retire_if_needed) {
static jlong netty_quiche_conn_new_scid(JNIEnv* env, jclass clazz, jlong conn, jlong scid, jint scid_len, jbyteArray reset_token, jboolean retire_if_needed, jlong seq) {
uint8_t* buf = (uint8_t*) (*env)->GetByteArrayElements(env, reset_token, 0);
jlong ret = quiche_conn_new_scid((quiche_conn *) conn, (const uint8_t *) scid, scid_len, buf, retire_if_needed == JNI_TRUE ? true : false);
jlong ret = quiche_conn_new_scid((quiche_conn *) conn, (const uint8_t *) scid, scid_len, buf, retire_if_needed == JNI_TRUE ? true : false, (uint64_t*) seq);
(*env)->ReleaseByteArrayElements(env, reset_token, (jbyte*)buf, JNI_ABORT);
return ret;
}
Expand Down Expand Up @@ -1134,7 +1134,7 @@ static const JNINativeMethod fixed_method_table[] = {
{ "quiche_conn_set_session", "(J[B)I", (void* ) netty_quiche_conn_set_session },
{ "quiche_conn_max_send_udp_payload_size", "(J)I", (void* ) netty_quiche_conn_max_send_udp_payload_size },
{ "quiche_conn_scids_left", "(J)I", (void* ) netty_quiche_conn_scids_left },
{ "quiche_conn_new_scid", "(JJI[BZ)J", (void* ) netty_quiche_conn_new_scid },
{ "quiche_conn_new_scid", "(JJI[BZJ)J", (void* ) netty_quiche_conn_new_scid },
{ "quiche_conn_retired_scid_next", "(J)[B", (void* ) netty_quiche_conn_retired_scid_next },
{ "quiche_config_new", "(I)J", (void *) netty_quiche_config_new },
{ "quiche_config_enable_dgram", "(JZII)V", (void *) netty_quiche_config_enable_dgram },
Expand Down