int i;
int i, ret = 0;
static void ssh_do_close(Ssh ssh){    int i;    struct ssh_channel *c;    ssh->state = SSH_STATE_CLOSED;    if (ssh->s) {        sk_close(ssh->s);        ssh->s = NULL;	notify_remote_exit(ssh->frontend);    }    /*     * Now we must shut down any port and X forwardings going     * through this connection.     */    if (ssh->channels) {	for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) {	    switch (c->type) {	      case CHAN_X11:		x11_close(c->u.x11.s);		break;	      case CHAN_SOCKDATA:		pfd_close(c->u.pfd.s);		break;	    }	    del234(ssh->channels, c);	    if (ssh->version == 2)		bufchain_clear(&c->v.v2.outbuffer);	    sfree(c);	}    }}