void wait_for_async(SSL *s)
{
    int width, fd;
    fd_set asyncfds;

    fd = SSL_get_async_wait_fd(s);
    if (fd < 0)
        return;

    width = fd + 1;
    FD_ZERO(&asyncfds);
    openssl_fdset(fd, &asyncfds);
    select(width, (void *)&asyncfds, NULL, NULL, NULL);
}