Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkisemils committed Dec 10, 2024
1 parent 102e9f4 commit c030b79
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
7 changes: 4 additions & 3 deletions ios/MullvadRustRuntime/include/mullvad_rust_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ void drop_ephemeral_peer_exchange_token(struct ExchangeCancelToken *sender);
* # Safety
* `public_key` and `ephemeral_key` must be valid respective `PublicKey` and `PrivateKey` types.
* They will not be valid after this function is called, and thus must be copied here.
* `packet_tunnel` and `tcp_connection` must be valid pointers to a packet tunnel and a TCP
* connection instances.
* `cancel_token` should be owned by the caller of this function.
* `packet_tunnel` must be valid pointers to a packet tunnel, the packet tunnel pointer must
* outlive the ephemeral peer exchange. `cancel_token` should be owned by the caller of this
* function.
*
*/
struct ExchangeCancelToken *request_ephemeral_peer(const uint8_t *public_key,
const uint8_t *ephemeral_key,
Expand Down
12 changes: 4 additions & 8 deletions mullvad-ios/src/ephemeral_peer_proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ impl PacketTunnelBridge {
}
}

// # Safety
// This is safe as long as the PacketTunnel class outlives the instance of the PacketTunnelBridge,
// and thus the ephemeral peer exchange. Since the peer exchange takes place in the packet tunnel
// process on iOS, it is certain _enough_ this will be the case.
// It is safe to implement Send for PacketTunnelBridge because the packet_tunnel
unsafe impl Send for PacketTunnelBridge {}

#[repr(C)]
Expand Down Expand Up @@ -80,9 +75,10 @@ pub unsafe extern "C" fn drop_ephemeral_peer_exchange_token(
/// # Safety
/// `public_key` and `ephemeral_key` must be valid respective `PublicKey` and `PrivateKey` types.
/// They will not be valid after this function is called, and thus must be copied here.
/// `packet_tunnel` and `tcp_connection` must be valid pointers to a packet tunnel and a TCP
/// connection instances.
/// `cancel_token` should be owned by the caller of this function.
/// `packet_tunnel` must be valid pointers to a packet tunnel, the packet tunnel pointer must
/// outlive the ephemeral peer exchange. `cancel_token` should be owned by the caller of this
/// function.
///
#[no_mangle]
pub unsafe extern "C" fn request_ephemeral_peer(
public_key: *const u8,
Expand Down
1 change: 0 additions & 1 deletion mullvad-ios/src/ephemeral_peer_proxy/peer_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ impl ExchangeCancelToken {
task.abort();
// CODE STENCH:
// Swift can call this function from a tokio context. That *will* crash.
// context.
let _ = inner.tokio_handle.block_on(task);
}
}
Expand Down

0 comments on commit c030b79

Please sign in to comment.