Data frame (#50)

* Rename DataFlag -> DataFlags
* Polish Data frame API
This commit is contained in:
Carl Lerche
2017-09-05 10:00:05 -07:00
committed by GitHub
parent bbcfffee46
commit b4fa5134f9
5 changed files with 121 additions and 74 deletions

View File

@@ -362,7 +362,7 @@ impl<B, P> Prioritize<B, P>
let mut stream = store.resolve(key);
if eos {
frame.set_end_stream();
frame.set_end_stream(true);
}
self.push_back_frame(frame.into(), &mut stream);
@@ -470,7 +470,7 @@ impl<B, P> Prioritize<B, P>
let eos = frame.is_end_stream();
if frame.payload().remaining() > len {
frame.unset_end_stream();
frame.set_end_stream(false);
}
Frame::Data(frame.map(|buf| {

View File

@@ -390,7 +390,7 @@ impl<B, P> StreamRef<B, P>
where B: Buf,
P: Peer,
{
pub fn send_data(&mut self, data: B, end_of_stream: bool)
pub fn send_data(&mut self, data: B, end_stream: bool)
-> Result<(), UserError>
{
let mut me = self.inner.lock().unwrap();
@@ -399,7 +399,8 @@ impl<B, P> StreamRef<B, P>
let stream = me.store.resolve(self.key);
// Create the data frame
let frame = frame::Data::from_buf(stream.id, data, end_of_stream);
let mut frame = frame::Data::new(stream.id, data);
frame.set_end_stream(end_stream);
me.actions.transition(stream, |actions, stream| {
// Send the data frame