fn do_accept(&mut self) {
        if let Ok((stream, _)) = self.poll.accept() {
            // handle TLS if it is configured
            if let Some(ssl_context) = &self.ssl_context {
                match Ssl::new(ssl_context).map(|v| v.accept(stream)) {
                    // handle case where we have a fully-negotiated
                    // TLS stream on accept()
                    Ok(Ok(tls_stream)) => {
                        self.add_established_tls_session(tls_stream);
                    }
                    // handle case where further negotiation is
                    // needed
                    Ok(Err(HandshakeError::WouldBlock(tls_stream))) => {
                        self.add_handshaking_tls_session(tls_stream);
                    }
                    // some other error has occurred and we drop the
                    // stream
                    Ok(Err(e)) => {
                        error!("accept failed: {}", e);
                        TCP_ACCEPT_EX.increment();
                    }
                    Err(e) => {
                        error!("accept failed: {}", e);
                        TCP_ACCEPT_EX.increment();
                    }
                }
            } else {
                self.add_plain_session(stream);
            };
            self.poll.reregister(LISTENER_TOKEN);
        }
    }
/// Call accept one time
// TODO(bmartin): splitting accept and negotiation into separate threads
// would allow us to handle TLS handshake with multiple threads and avoid
// the overhead of re-registering the listener after each accept.
Call accept one time
TODO(bmartin): splitting accept and negotiation into separate threads
would allow us to handle TLS handshake with multiple threads and avoid
the overhead of re-registering the listener after each accept.
Call accept one time TODO ( bmartin ) : splitting accept and negotiation into separate threads would allow us to handle TLS handshake with multiple threads and avoid the overhead of re - registering the listener after each accept .
fn do_accept(&mut self) {
        if let Ok((stream, _)) = self.poll.accept() {
            // handle TLS if it is configured
            if let Some(ssl_context) = &self.ssl_context {
                match Ssl::new(ssl_context).map(|v| v.accept(stream)) {
                    // handle case where we have a fully-negotiated
                    // TLS stream on accept()
                    Ok(Ok(tls_stream)) => {
                        self.add_established_tls_session(tls_stream);
                    }
                    // handle case where further negotiation is
                    // needed
                    Ok(Err(HandshakeError::WouldBlock(tls_stream))) => {
                        self.add_handshaking_tls_session(tls_stream);
                    }
                    // some other error has occurred and we drop the
                    // stream
                    Ok(Err(e)) => {
                        error!("accept failed: {}", e);
                        TCP_ACCEPT_EX.increment();
                    }
                    Err(e) => {
                        error!("accept failed: {}", e);
                        TCP_ACCEPT_EX.increment();
                    }
                }
            } else {
                self.add_plain_session(stream);
            };
            self.poll.reregister(LISTENER_TOKEN);
        }
    }
fn do_accept ( & mut self ) { if let Ok ( ( stream , _ ) ) = self . poll . accept ( ) { // handle TLS if it is configured if let Some ( ssl_context ) = & self . ssl_context { match Ssl :: new ( ssl_context ) . map ( | v | v . accept ( stream ) ) { // handle case where we have a fully-negotiated // TLS stream on accept() Ok ( Ok ( tls_stream ) ) => { self . add_established_tls_session ( tls_stream ) ; } // handle case where further negotiation is // needed Ok ( Err ( HandshakeError :: WouldBlock ( tls_stream ) ) ) => { self . add_handshaking_tls_session ( tls_stream ) ; } // some other error has occurred and we drop the // stream Ok ( Err ( e ) ) => { error ! ( " " e ) ; TCP_ACCEPT_EX . increment ( ) ; } Err ( e ) => { error ! ( " " e ) ; TCP_ACCEPT_EX . increment ( ) ; } } } else { self . add_plain_session ( stream ) ; } ; self . poll . reregister ( LISTENER_TOKEN ) ; } }
Call accept one time
TODO(bmartin): splitting accept and negotiation into separate threads
would allow us to handle TLS handshake with multiple threads and avoid
the overhead of re-registering the listener after each accept.
Call accept one time TODO ( bmartin ) : splitting accept and negotiation into separate threads would allow us to handle TLS handshake with multiple threads and avoid the overhead of re - registering the listener after each accept .
&mut self
&mut self