fix(server): allow TLS shutdown before dropping connections with no_proto
This is important for TLS connections in particular Closes #1380
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							8e7af7b9f1
						
					
				
				
					commit
					60d0eaf891
				
			| @@ -447,6 +447,20 @@ where I: AsyncRead + AsyncWrite, | |||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     pub fn shutdown(&mut self) -> Poll<(), io::Error> { | ||||||
|  |         match self.io.io_mut().shutdown() { | ||||||
|  |             Ok(Async::NotReady) => Ok(Async::NotReady), | ||||||
|  |             Ok(Async::Ready(())) => { | ||||||
|  |                 trace!("shut down IO"); | ||||||
|  |                 Ok(Async::Ready(())) | ||||||
|  |             } | ||||||
|  |             Err(e) => { | ||||||
|  |                 debug!("error shutting down IO: {}", e); | ||||||
|  |                 Err(e) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     pub fn close_read(&mut self) { |     pub fn close_read(&mut self) { | ||||||
|         self.state.close_read(); |         self.state.close_read(); | ||||||
|     } |     } | ||||||
| @@ -540,10 +554,7 @@ where I: AsyncRead + AsyncWrite, | |||||||
|     #[inline] |     #[inline] | ||||||
|     fn close(&mut self) -> Poll<(), Self::SinkError> { |     fn close(&mut self) -> Poll<(), Self::SinkError> { | ||||||
|         try_ready!(self.poll_complete()); |         try_ready!(self.poll_complete()); | ||||||
|         self.io.io_mut().shutdown().map_err(|err| { |         self.shutdown() | ||||||
|             debug!("error closing: {}", err); |  | ||||||
|             err |  | ||||||
|         }) |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -210,6 +210,7 @@ where | |||||||
|         self.poll_flush()?; |         self.poll_flush()?; | ||||||
|  |  | ||||||
|         if self.is_done() { |         if self.is_done() { | ||||||
|  |             try_ready!(self.conn.shutdown()); | ||||||
|             trace!("Dispatch::poll done"); |             trace!("Dispatch::poll done"); | ||||||
|             Ok(Async::Ready(())) |             Ok(Async::Ready(())) | ||||||
|         } else { |         } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user