Skip to content

Commit

Permalink
Fix impl
Browse files Browse the repository at this point in the history
  • Loading branch information
normanmaurer committed Nov 27, 2023
1 parent 8d86720 commit 96f1bd7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
11 changes: 6 additions & 5 deletions quiche/include/quiche.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,18 +715,19 @@ uint64_t quiche_conn_new_scid(quiche_conn *conn,
const uint8_t *reset_token, bool retire_if_needed);

// Requests the stack to perform path validation of the proposed 4-tuple.
uint64_t quiche_conn_probe_path(quiche_conn *conn,
int quiche_conn_probe_path(quiche_conn *conn,
const struct sockaddr *local, socklen_t local_len,
const struct sockaddr *peer, socklen_t peer_len);
const struct sockaddr *peer, socklen_t peer_len, uint64_t *seq);

// Migrates the connection to a new local address.
uint64_t quiche_conn_migrate_source(quiche_conn *conn, const struct sockaddr *local, socklen_t local_len);
int quiche_conn_migrate_source(quiche_conn *conn, const struct sockaddr *local, socklen_t local_len, uint64_t *seq);

// Migrates the connection over the given network path between "local"
// and "peer".
uint64_t quiche_conn_migrate(quiche_conn *conn,
int quiche_conn_migrate(quiche_conn *conn,
const struct sockaddr *local, socklen_t local_len,
const struct sockaddr *peer, socklen_t peer_len);
const struct sockaddr *peer, socklen_t peer_len,
uint64_t *seq);

enum quiche_path_event_type {
QUICHE_PATH_EVENT_NEW,
Expand Down
31 changes: 21 additions & 10 deletions quiche/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1468,37 +1468,48 @@ pub extern fn quiche_conn_retired_scid_next(
#[no_mangle]
pub extern fn quiche_conn_probe_path(
conn: &mut Connection, local: &sockaddr, local_len: socklen_t,
peer: &sockaddr, peer_len: socklen_t,
) -> u64 {
peer: &sockaddr, peer_len: socklen_t, seq: &mut u64,
) -> c_int {
let local = std_addr_from_c(local, local_len);
let peer = std_addr_from_c(peer, peer_len);
match conn.probe_path(local, peer) {
Ok(v) => v,
Err(e) => e.to_c() as u64,
Ok(v) => {
unsafe { *seq = v }

Check failure on line 1477 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche

unnecessary `unsafe` block

Check failure on line 1477 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / android_ndk_lts (aarch64-linux-android)

unnecessary `unsafe` block

Check failure on line 1477 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_multiarch (i686-unknown-linux-gnu)

unnecessary `unsafe` block

Check failure on line 1477 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_macos

unnecessary `unsafe` block

Check failure on line 1477 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (x86_64-pc-windows-msvc)

unnecessary `unsafe` block
0
},
Err(e) => e.to_c() as c_int,
}
}

#[no_mangle]
pub extern fn quiche_conn_migrate_source(
conn: &mut Connection, local: &sockaddr, local_len: socklen_t,
) -> u64 {
seq: &mut u64,
) -> c_int {
let local = std_addr_from_c(local, local_len);
match conn.migrate_source(local) {
Ok(v) => v,
Err(e) => e.to_c() as u64,
Ok(v) => {
unsafe { *seq = v }

Check failure on line 1492 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche

unnecessary `unsafe` block

Check failure on line 1492 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / android_ndk_lts (aarch64-linux-android)

unnecessary `unsafe` block

Check failure on line 1492 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_multiarch (i686-unknown-linux-gnu)

unnecessary `unsafe` block

Check failure on line 1492 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_macos

unnecessary `unsafe` block

Check failure on line 1492 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (x86_64-pc-windows-msvc)

unnecessary `unsafe` block
0
},
Err(e) => e.to_c() as c_int,
}
}

#[no_mangle]
pub extern fn quiche_conn_migrate(
conn: &mut Connection, local: &sockaddr, local_len: socklen_t,
peer: &sockaddr, peer_len: socklen_t,
) -> u64 {
seq: &mut u64
) -> c_int {
let local = std_addr_from_c(local, local_len);
let peer = std_addr_from_c(peer, peer_len);
match conn.migrate(local, peer) {
Ok(v) => v,
Err(e) => e.to_c() as u64,
Ok(v) => {
unsafe { *seq = v }

Check failure on line 1509 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche

unnecessary `unsafe` block

Check failure on line 1509 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / android_ndk_lts (aarch64-linux-android)

unnecessary `unsafe` block

Check failure on line 1509 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_multiarch (i686-unknown-linux-gnu)

unnecessary `unsafe` block

Check failure on line 1509 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_macos

unnecessary `unsafe` block

Check failure on line 1509 in quiche/src/ffi.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (x86_64-pc-windows-msvc)

unnecessary `unsafe` block
0
},
Err(e) => e.to_c() as c_int,
}
}

Expand Down

0 comments on commit 96f1bd7

Please sign in to comment.