doc/designs/ddd/ddd-06-mem-uv.c
/*
 * The application wants to close the connection and free bookkeeping
 * structures.
 */
The application wants to close the connection and free bookkeeping
structures.
The application wants to close the connection and free bookkeeping structures .
void teardown(APP_CONN *conn)
{
    char teardown_done = 0;
    if (conn == NULL)
        return;
    BIO_free_all(conn->net_bio);
    SSL_free(conn->ssl);
    uv_cancel((uv_req_t *)&conn->tcp_connect);
    conn->teardown_done = &teardown_done;
    uv_close((uv_handle_t *)conn->stream, teardown_continued);
    while (!teardown_done)
        uv_run(uv_default_loop(), UV_RUN_DEFAULT);
}
void teardown ( APP_CONN * conn ) { char teardown_done = 0 ; if ( conn == NULL ) return ; BIO_free_all ( conn -> net_bio ) ; SSL_free ( conn -> ssl ) ; uv_cancel ( ( uv_req_t * ) & conn -> tcp_connect ) ; conn -> teardown_done = & teardown_done ; uv_close ( ( uv_handle_t * ) conn -> stream , teardown_continued ) ; while ( ! teardown_done ) uv_run ( uv_default_loop ( ) , UV_RUN_DEFAULT ) ; }
The application wants to close the connection and free bookkeeping
 structures.
The application wants to close the connection and free bookkeeping structures .
/* Just wait synchronously until teardown completes. */