Skip to content

Commit 414c182

Browse files
committed
add poll_send_data() methods
1 parent 49c808e commit 414c182

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

h3/src/connection.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::{
2121
varint::VarInt,
2222
},
2323
qpack,
24-
quic::{self, SendStream as _},
24+
quic::{self, SendStream},
2525
stream::{self, AcceptRecvStream, AcceptedRecvStream, BufRecvStream, UniStreamHeader},
2626
webtransport::SessionId,
2727
};
@@ -765,6 +765,13 @@ where
765765
Ok(())
766766
}
767767

768+
/// Send some data on the response body.
769+
pub fn poll_send_data(&mut self, cx: &mut Context<'_>, buf: B) -> Poll<Result<(), Error>> {
770+
ready!(self.stream.poll_ready(cx))?;
771+
let frame = Frame::Data(buf);
772+
Poll::Ready(Ok(self.stream.send_data(frame)?))
773+
}
774+
768775
/// Send a set of trailers to end the request.
769776
pub async fn send_trailers(&mut self, trailers: HeaderMap) -> Result<(), Error> {
770777
//= https://www.rfc-editor.org/rfc/rfc9114#section-4.2

h3/src/server.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,11 @@ where
745745
self.inner.send_data(buf).await
746746
}
747747

748+
/// Poll for data send from the client
749+
pub fn poll_send_data(&mut self, cx: &mut Context<'_>, buf: B) -> Poll<Result<(), Error>> {
750+
self.inner.poll_send_data(cx, buf)
751+
}
752+
748753
/// Stop a stream with an error code
749754
///
750755
/// The code can be [`Code::H3_NO_ERROR`].

0 commit comments

Comments
 (0)