Delete comments
This commit is contained in:
		| @@ -161,32 +161,6 @@ impl<T, P, B> Connection<T, P, B> | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     pub fn send_data(self, | ||||
|                      id: StreamId, | ||||
|                      data: B, | ||||
|                      end_of_stream: bool) | ||||
|         -> sink::Send<Self> | ||||
|     { | ||||
|         self.send(Frame::Data { | ||||
|             id, | ||||
|             data, | ||||
|             end_of_stream, | ||||
|         }) | ||||
|     } | ||||
|  | ||||
|     pub fn send_trailers(self, | ||||
|                          id: StreamId, | ||||
|                          headers: HeaderMap) | ||||
|         -> sink::Send<Self> | ||||
|     { | ||||
|         self.send(Frame::Trailers { | ||||
|             id, | ||||
|             headers, | ||||
|         }) | ||||
|     } | ||||
|     */ | ||||
|  | ||||
|     // ===== Private ===== | ||||
|  | ||||
|     /// Returns `Ready` when the `Connection` is ready to receive a frame from | ||||
| @@ -261,129 +235,3 @@ impl<T, B> Connection<T, server::Peer, B> | ||||
|         self.streams.next_incoming() | ||||
|     } | ||||
| } | ||||
|  | ||||
| /* | ||||
| impl<T, B> Connection<T, Client, B> | ||||
|     where T: AsyncRead + AsyncWrite, | ||||
|           B: IntoBuf, | ||||
| { | ||||
|     pub fn send_request(self, | ||||
|                         id: StreamId, // TODO: Generate one internally? | ||||
|                         request: request::Head, | ||||
|                         end_of_stream: bool) | ||||
|         -> sink::Send<Self> | ||||
|     { | ||||
|         self.send(Frame::Headers { | ||||
|             id: id, | ||||
|             headers: request, | ||||
|             end_of_stream: end_of_stream, | ||||
|         }) | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl<T, B> Connection<T, Server, B> | ||||
|     where T: AsyncRead + AsyncWrite, | ||||
|           B: IntoBuf, | ||||
| { | ||||
|     pub fn send_response(self, | ||||
|                         id: StreamId, // TODO: Generate one internally? | ||||
|                         response: response::Head, | ||||
|                         end_of_stream: bool) | ||||
|         -> sink::Send<Self> | ||||
|     { | ||||
|         self.send(Frame::Headers { | ||||
|             id: id, | ||||
|             headers: response, | ||||
|             end_of_stream: end_of_stream, | ||||
|         }) | ||||
|     } | ||||
|  | ||||
|     pub fn send_push_promise(self, | ||||
|                              id: StreamId, | ||||
|                              promised_id: StreamId) | ||||
|         -> sink::Send<Self> | ||||
|     { | ||||
|         self.send(Frame::PushPromise { | ||||
|             id, | ||||
|             promised_id, | ||||
|         }) | ||||
|     } | ||||
| } | ||||
| */ | ||||
|  | ||||
| /* | ||||
| impl<T, P, B> Sink for Connection<T, P, B> | ||||
|     where T: AsyncRead + AsyncWrite, | ||||
|           P: Peer, | ||||
|           B: IntoBuf, | ||||
| { | ||||
|     type SinkItem = Frame<P::Send, B>; | ||||
|     type SinkError = ConnectionError; | ||||
|  | ||||
|     /// Sends a frame to the remote. | ||||
|     fn start_send(&mut self, item: Self::SinkItem) | ||||
|         -> StartSend<Self::SinkItem, Self::SinkError> | ||||
|     { | ||||
|         // TODO: Ensure connection is not corrupt | ||||
|  | ||||
|         // Ensure that the connection is ready to accept a new frame | ||||
|         if !try!(self.poll_ready()).is_ready() { | ||||
|             return Ok(AsyncSink::NotReady(item)); | ||||
|         } | ||||
|  | ||||
|         let frame = match item { | ||||
|             Frame::Headers { id, headers, end_of_stream } => { | ||||
|                 // This is a one-way conversion. By checking `poll_ready` first (above), | ||||
|                 // it's already been determined that the inner `Sink` can accept the item. | ||||
|                 // If the item is rejected, then there is a bug. | ||||
|                 let frame = P::convert_send_message(id, headers, end_of_stream); | ||||
|  | ||||
|                 // Update the stream state | ||||
|                 self.streams.send_headers(&frame)?; | ||||
|  | ||||
|                 frame::Frame::Headers(frame) | ||||
|             } | ||||
|             Frame::Data { id, data, end_of_stream } => { | ||||
|                 let frame = frame::Data::from_buf( | ||||
|                     id, data.into_buf(), end_of_stream); | ||||
|  | ||||
|                 self.streams.send_data(&frame)?; | ||||
|  | ||||
|                 frame.into() | ||||
|             } | ||||
|             Frame::Reset { id, error } => frame::Reset::new(id, error).into(), | ||||
|             Frame::Trailers { id, headers } => { | ||||
|                 let mut frame = frame::Headers::new( | ||||
|                     id, | ||||
|                     frame::Pseudo::default(), | ||||
|                     headers); | ||||
|  | ||||
|                 frame.set_end_stream(); | ||||
|  | ||||
|                 self.streams.send_headers(&frame)?; | ||||
|  | ||||
|                 frame::Frame::Headers(frame) | ||||
|             } | ||||
|             /* | ||||
|             Frame::PushPromise { id, promise } => { | ||||
|                 unimplemented!(); | ||||
|             } | ||||
|             Frame::Error { id, error } => { | ||||
|                 unimplemented!(); | ||||
|             } | ||||
|             */ | ||||
|             _ => unimplemented!(), | ||||
|         }; | ||||
|  | ||||
|         // Write the frame to the socket | ||||
|         let res = self.codec.start_send(frame)?; | ||||
|  | ||||
|         // Ensure that the write was accepted. This is always true due to the | ||||
|         // check at the top of the function | ||||
|         assert!(res.is_ready()); | ||||
|  | ||||
|         // Return success | ||||
|         Ok(AsyncSink::Ready) | ||||
|     } | ||||
| } | ||||
| */ | ||||
|   | ||||
| @@ -112,18 +112,6 @@ impl<T> FramedRead<T> { | ||||
|     } | ||||
| } | ||||
|  | ||||
| /* | ||||
| impl<T: ApplySettings> ApplySettings for FramedRead<T> { | ||||
|     fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> { | ||||
|         self.inner.get_mut().apply_local_settings(set) | ||||
|     } | ||||
|  | ||||
|     fn apply_remote_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> { | ||||
|         self.inner.get_mut().apply_remote_settings(set) | ||||
|     } | ||||
| } | ||||
| */ | ||||
|  | ||||
| impl<T> futures::Stream for FramedRead<T> | ||||
|     where T: AsyncRead, | ||||
| { | ||||
|   | ||||
| @@ -1,39 +0,0 @@ | ||||
| use ConnectionError; | ||||
| use proto::*; | ||||
|  | ||||
| /// An alias for types that implement Stream + Sink over H2 frames. | ||||
| pub trait FrameStream<B>: Stream<Item = Frame, Error = ConnectionError> + | ||||
|                           Sink<SinkItem = Frame<B>, SinkError = ConnectionError> | ||||
| { | ||||
|     fn poll_ready(&mut self) -> Poll<(), ConnectionError>; | ||||
| } | ||||
|  | ||||
| pub trait Stage<B> { | ||||
|  | ||||
|     fn poll<T>(&mut self, upstream: &mut T) -> Poll<Option<Frame>, ConnectionError> | ||||
|         where T: FrameStream<B>, | ||||
|     { | ||||
|         upstream.poll() | ||||
|     } | ||||
|  | ||||
|     fn poll_ready<T>(&mut self, upstream: &mut T) -> Poll<(), ConnectionError> | ||||
|         where T: FrameStream<B>, | ||||
|     { | ||||
|         upstream.poll_ready() | ||||
|     } | ||||
|  | ||||
|     fn start_send<T>(&mut self, item: Frame<B>, upstream: &mut T) -> StartSend<Frame<B>, ConnectionError> | ||||
|         where T: FrameStream<B>, | ||||
|     { | ||||
|         upstream.start_send(item) | ||||
|     } | ||||
|  | ||||
|     fn poll_complete<T>(&mut self, upstream: &mut T) -> Poll<(), ConnectionError> | ||||
|         where T: FrameStream<B>, | ||||
|     { | ||||
|         upstream.poll_complete() | ||||
|     } | ||||
| } | ||||
|  | ||||
| pub trait StreamStage { | ||||
| } | ||||
		Reference in New Issue
	
	Block a user