MCPcopy Create free account
hub / github.com/aws/clock-bound / recv

Method recv

clock-bound/src/daemon/async_ring_buffer.rs:157–176  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

155 /// it is guaranteed that no messages were received on this channel.
156 #[expect(clippy::missing_panics_doc, reason = "not handling poisoned mutex")]
157 pub async fn recv(&self) -> Result<T, BufferClosedError> {
158 // loop to check values, then await for notification, then get value again
159 loop {
160 {
161 // brace drops guard
162 let mut guard = self.inner.lock().unwrap();
163 if guard.sender_dropped {
164 return Err(BufferClosedError);
165 }
166 if let Some(Side::Sender) = guard.disruption_handled {
167 // it's a bug for this to repeatedly fire from the same channel
168 tracing::debug!("Receiving when sender handled disruption");
169 }
170 if let Some(value) = guard.pop() {
171 return Ok(value);
172 }
173 }
174 self.notifiee.notified().await;
175 }
176 }
177
178 /// Handle a clock disruption event
179 ///

Callers 2

concurrent_send_receiveFunction · 0.45

Calls 1

popMethod · 0.45

Tested by

no test coverage detected