+
+ // /// Creates a [`Connection`] for the next `accept`ed TCP connection at the bound socket.
+ // ///
+ // /// # Example
+ // ///
+ // /// Basic usage:
+ // ///
+ // /// ```ignore
+ // /// let mut server = TlsListener::bind("127.0.0.1:3456", config.into()).await?;
+ // /// while let Some(mut conn) = server.next().await {
+ // /// // do something with connection
+ // /// }
+ // /// ```
+ // pub async fn accept(&self) -> anyhow::Result<Connection> {
+ // let (tcp_stream, peer_addr) = self.listener.accept().await?;
+ // debug!("Received connection attempt from {}", peer_addr);
+ //
+ // match self.acceptor.accept(tcp_stream).await {
+ // Ok(tls_stream) => {
+ // debug!("Completed TLS handshake with {}", peer_addr);
+ // Ok(Connection::from(TlsConnectionMetadata::Listener {
+ // local_addr: self.local_addrs.clone(),
+ // peer_addr,
+ // stream: tls_stream,
+ // }))
+ // }
+ //
+ // Err(e) => {
+ // warn!("Could not encrypt connection with TLS from {}", peer_addr);
+ // Err(anyhow::Error::new(e))
+ // }
+ // }
+ // }