Start hooking up sending data

This commit is contained in:
Carl Lerche
2017-08-07 21:01:15 -07:00
parent 6053ee059d
commit 71da8d121f
6 changed files with 76 additions and 18 deletions

View File

@@ -67,7 +67,7 @@ impl<P, B> Send<P, B>
/// Update state reflecting a new, locally opened stream
///
/// Returns the stream state if successful. `None` if refused
pub fn open(&mut self) -> Result<(StreamId, Stream<B>), ConnectionError> {
pub fn open(&mut self) -> Result<Stream<B>, ConnectionError> {
try!(self.ensure_can_open());
if let Some(max) = self.max_streams {
@@ -76,7 +76,7 @@ impl<P, B> Send<P, B>
}
}
let ret = (self.next_stream_id, Stream::new());
let ret = Stream::new(self.next_stream_id);
// Increment the number of locally initiated streams
self.num_streams += 1;
@@ -106,8 +106,8 @@ impl<P, B> Send<P, B>
}
pub fn send_data(&mut self,
frame: &frame::Data<B>,
stream: &mut Stream<B>)
frame: frame::Data<B>,
stream: &mut store::Ptr<B>)
-> Result<(), ConnectionError>
{
let sz = frame.payload().remaining();
@@ -148,6 +148,8 @@ impl<P, B> Send<P, B>
try!(stream.state.send_close());
}
self.prioritize.queue_frame(frame.into(), stream);
Ok(())
}