diff --git a/transport/src/lib.rs b/transport/src/lib.rs index c33ab0f..0982496 100644 --- a/transport/src/lib.rs +++ b/transport/src/lib.rs @@ -1,7 +1,7 @@ // Coming from https://github.com/hyperium/h3, the goal is to // do a PR with the changes afterwards -use std::task::{self, Poll}; +use std::{task::{self, Poll}, sync::Arc}; use bytes::{Buf, BufMut}; use anyhow::Error; @@ -131,21 +131,41 @@ pub async fn accept_recv(conn: &mut C) -> anyhow::Result(conn: Arc>) -> anyhow::Result, Error> { + Ok(std::future::poll_fn(|cx| conn.lock().unwrap().poll_accept_recv(cx)).await?) + +} + pub async fn accept_bidi(conn: &mut C) -> anyhow::Result, Error> { Ok(std::future::poll_fn(|cx| conn.poll_accept_bidi(cx)).await?) } +pub async fn accept_bidi_shared(conn: Arc>) -> anyhow::Result, Error> { + Ok(std::future::poll_fn(|cx| conn.lock().unwrap().poll_accept_bidi(cx)).await?) + +} + pub async fn open_send(conn: &mut C) -> anyhow::Result { Ok(std::future::poll_fn(|cx| conn.poll_open_send(cx)).await?) } +pub async fn open_send_shared(conn: Arc>) -> anyhow::Result { + Ok(std::future::poll_fn(|cx| conn.lock().unwrap().poll_open_send(cx)).await?) + +} + pub async fn open_bidi(conn: &mut C) -> anyhow::Result { Ok(std::future::poll_fn(|cx| conn.poll_open_bidi(cx)).await?) } +pub async fn open_bidi_shared(conn: Arc>) -> anyhow::Result { + Ok(std::future::poll_fn(|cx| conn.lock().unwrap().poll_open_bidi(cx)).await?) + +} + pub async fn recv>(recv: &mut R , outbuf: &mut BM) -> anyhow::Result {