Skip to main content

pamoja_transport_recv_within

Function pamoja_transport_recv_within 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_transport_recv_within( transport: *mut PamojaTransport, timeout_ms: u64, out_message: *mut *mut PamojaMessage, out_timed_out: *mut bool, ) -> PamojaStatus
Expand description

Waits a limited time for the next message a transport delivers.

Running out of time loses nothing: a message that arrives afterwards waits for the next receive. This is the call to use rather than abandoning a receive that is still waiting, which would take that message instead.

§Arguments

  • transport - the transport to receive from.
  • timeout_ms - how long to wait, in milliseconds.
  • out_message - receives a message handle to release with pamoja_message_free, or null when the time ran out or the link has ended.
  • out_timed_out - receives whether the time ran out before a message arrived.

§Returns

PamojaStatus::Ok with a message, with the time run out, or with null once the link has ended, or PamojaStatus::Closed if the transport is not connected.

§Safety

transport must be a live handle, and out_message and out_timed_out must be writable.