fix(lib): fix no_proto dispatcher to flush queue before polling more body
This commit is contained in:
		| @@ -306,7 +306,7 @@ where I: AsyncRead + AsyncWrite, | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fn has_queued_body(&self) -> bool { |     pub fn has_queued_body(&self) -> bool { | ||||||
|         match self.state.writing { |         match self.state.writing { | ||||||
|             Writing::Body(_, Some(_)) => true, |             Writing::Body(_, Some(_)) => true, | ||||||
|             _ => false, |             _ => false, | ||||||
|   | |||||||
| @@ -148,6 +148,8 @@ where | |||||||
|                     self.conn.close_write(); |                     self.conn.close_write(); | ||||||
|                     return Ok(Async::Ready(())); |                     return Ok(Async::Ready(())); | ||||||
|                 } |                 } | ||||||
|  |             } else if self.conn.has_queued_body() { | ||||||
|  |                 try_ready!(self.poll_flush()); | ||||||
|             } else if let Some(mut body) = self.body_rx.take() { |             } else if let Some(mut body) = self.body_rx.take() { | ||||||
|                 let chunk = match body.poll()? { |                 let chunk = match body.poll()? { | ||||||
|                     Async::Ready(Some(chunk)) => { |                     Async::Ready(Some(chunk)) => { | ||||||
| @@ -165,7 +167,7 @@ where | |||||||
|                         return Ok(Async::NotReady); |                         return Ok(Async::NotReady); | ||||||
|                     } |                     } | ||||||
|                 }; |                 }; | ||||||
|                 self.conn.write_body(Some(chunk))?; |                 assert!(self.conn.write_body(Some(chunk))?.is_ready()); | ||||||
|             } else { |             } else { | ||||||
|                 return Ok(Async::NotReady); |                 return Ok(Async::NotReady); | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user