/// Helper function that asynchronously disconnects connection on the default tokio executor.
Helper function that asynchronously disconnects connection on the default tokio executor.
Helper function that asynchronously disconnects connection on the default tokio executor .
fn disconnect(mut conn: Conn) {
    let disconnected = conn.inner.disconnected;
    // Mark conn as disconnected.
    conn.inner.disconnected = true;
    if !disconnected {
        // Server will report broken connection if spawn fails.
        use tokio::executor::Executor;
        // this might fail if, say, the runtime is shutting down, but we've done what we could
        let _ = tokio::executor::DefaultExecutor::current().spawn(Box::pin(async move {
            if let Ok(conn) = conn.cleanup().await {
                let _ = conn.disconnect().await;
            }
        }));
    }
}
fn disconnect ( mut conn : Conn ) { let disconnected = conn . inner . disconnected ; // Mark conn as disconnected. conn . inner . disconnected = true ; if ! disconnected { // Server will report broken connection if spawn fails. use tokio :: executor :: Executor ; // this might fail if, say, the runtime is shutting down, but we've done what we could let _ = tokio :: executor :: DefaultExecutor :: current ( ) . spawn ( Box :: pin ( async move { if let Ok ( conn ) = conn . cleanup ( ) . await { let _ = conn . disconnect ( ) . await ; } } ) ) ; } }
Helper function that asynchronously disconnects connection on the default tokio executor.
Helper function that asynchronously disconnects connection on the default tokio executor .
conn
Conn