if (c && ((int)c->remoteid) != -1) {
if (c && !c->halfopen) {
static void ssh1_msg_channel_close(Ssh ssh, struct Packet *pktin){    /* Remote side closes a channel. */    unsigned i = ssh_pkt_getuint32(pktin);    struct ssh_channel *c;    c = find234(ssh->channels, &i, ssh_channelfind);    if (c && ((int)c->remoteid) != -1) {	int closetype;	closetype =	    (pktin->type == SSH1_MSG_CHANNEL_CLOSE ? 1 : 2);	if ((c->closes == 0) && (c->type == CHAN_X11)) {	    logevent("Forwarded X11 connection terminated");	    assert(c->u.x11.s != NULL);	    x11_close(c->u.x11.s);	    c->u.x11.s = NULL;	}	if ((c->closes == 0) && (c->type == CHAN_SOCKDATA)) {	    logevent("Forwarded port closed");	    assert(c->u.pfd.s != NULL);	    pfd_close(c->u.pfd.s);	    c->u.pfd.s = NULL;	}	c->closes |= (closetype << 2);   /* seen this message */	if (!(c->closes & closetype)) {	    send_packet(ssh, pktin->type, PKT_INT, c->remoteid,			PKT_END);	    c->closes |= closetype;      /* sent it too */	}	if (c->closes == 15) {	    del234(ssh->channels, c);	    sfree(c);	}    } else {	bombout(("Received CHANNEL_CLOSE%s for %s channel %d\n",		 pktin->type == SSH1_MSG_CHANNEL_CLOSE ? "" :		 "_CONFIRMATION", c ? "half-open" : "nonexistent",		 i));    }}