Skip to content
Open
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
8 changes: 6 additions & 2 deletions crates/ll_mp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3639,10 +3639,12 @@ where

/// Create a point-to-point channel instead of using a broker-client channel
pub fn new_p2p(shmem_provider: SP, sender_id: ClientId) -> Result<Self, Error> {
let mut shmem_provider = shmem_provider;
let sender = LlmpSender::new(shmem_provider.clone(), sender_id, false)?;
let shmem = shmem_provider.clone_ref(&sender.out_shmems[0].shmem)?;
let receiver = LlmpReceiver::on_existing_shmem(
shmem_provider,
sender.out_shmems[0].shmem.clone(),
shmem,
None,
)?;
Ok(Self { sender, receiver })
Expand All @@ -3659,10 +3661,12 @@ where
current_broker_shmem: SHM,
last_msg_recvd_offset: Option<u64>,
) -> Result<Self, Error> {
let mut shmem_provider = shmem_provider;
let mut current_broker_shmem = current_broker_shmem;
Ok(Self {
receiver: LlmpReceiver::on_existing_shmem(
shmem_provider.clone(),
current_broker_shmem.clone(),
shmem_provider.clone_ref(&mut current_broker_shmem)?,
last_msg_recvd_offset,
)?,
sender: LlmpSender::on_existing_shmem(
Expand Down
11 changes: 5 additions & 6 deletions crates/shmem_providers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl Display for ShMemId {
///
/// They are the backbone of `llmp` for inter-process communication.
/// All you need for scaling on a new target is to implement this interface, as well as the respective [`ShMemProvider`].
pub trait ShMem: Sized + Debug + Clone + DerefMut<Target = [u8]> {
pub trait ShMem: Sized + Debug + DerefMut<Target = [u8]> {
/// Get the id of this shared memory mapping
fn id(&self) -> ShMemId;

Expand Down Expand Up @@ -757,7 +757,7 @@ pub mod unix_shmem {
/// Mmap-based The sharedmap impl for unix using [`shm_open`] and [`mmap`].
/// Default on `MacOS` and `iOS`, where we need a central point to unmap
/// shared mem segments for dubious Mach kernel reasons.
#[derive(Debug, Clone)]
#[derive(Debug)]
pub struct MmapShMem {
/// The path of this shared memory segment.
/// None in case we didn't [`shm_open`] this ourselves, but someone sent us the FD.
Expand Down Expand Up @@ -1098,7 +1098,7 @@ pub mod unix_shmem {
}

/// The default sharedmap impl for unix using shmctl & shmget
#[derive(Debug, Clone)]
#[derive(Debug)]
pub struct CommonUnixShMem {
id: ShMemId,
map: *mut u8,
Expand Down Expand Up @@ -1250,7 +1250,7 @@ pub mod unix_shmem {
use crate::{Error, ShMem, ShMemId, ShMemProvider};

/// An ashmem based impl for linux/android
#[derive(Debug, Clone)]
#[derive(Debug)]
pub struct AshmemShMem {
id: ShMemId,
map: *mut u8,
Expand Down Expand Up @@ -1469,7 +1469,7 @@ pub mod unix_shmem {

/// An memfd based impl for linux/android
#[cfg(unix)]
#[derive(Debug, Clone)]
#[derive(Debug)]
pub struct MemfdShMem {
id: ShMemId,
map: *mut u8,
Expand Down Expand Up @@ -1667,7 +1667,6 @@ pub mod win32_shmem {
const INVALID_HANDLE_VALUE: *mut c_void = -1isize as *mut c_void;

/// The default [`ShMem`] impl for Windows using `shmctl` & `shmget`
#[derive(Clone)]
pub struct Win32ShMem {
id: ShMemId,
handle: HANDLE,
Expand Down
Loading