proxy: listener error handling fixup
If the listening socket goes into some error state we'll get std::io::Errors rather than higher level errors from the native_tls::TlsAcceptor, those are usually fatal. (Ran into this after performing a shutdown() on the file descriptor, after which the future just endlessly loops in accept().) Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
		@ -76,7 +76,15 @@ fn run() -> Result<(), Error> {
 | 
			
		||||
            // the cert and closes the connection, so we follow up with mapping
 | 
			
		||||
            // it to an option and then filtering None with filter_map
 | 
			
		||||
            Ok(c) => Ok::<_, Error>(Some(c)),
 | 
			
		||||
            Err(_) => Ok(None),
 | 
			
		||||
            Err(e) => {
 | 
			
		||||
                if let Some(_io) = e.downcast_ref::<std::io::Error>() {
 | 
			
		||||
                    // "real" IO errors should not simply be ignored
 | 
			
		||||
                    bail!("shutting down...");
 | 
			
		||||
                } else {
 | 
			
		||||
                    // handshake errors just get filtered by filter_map() below:
 | 
			
		||||
                    Ok(None)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
        .filter_map(|r| {
 | 
			
		||||
            // Filter out the Nones
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user