Mercurial > dropbear
comparison common-channel.c @ 329:8ed0dce45126
disapproval of revision 'a4c1a9be4db326f8f7adcf30f876fadedf87b203'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 10 Jun 2006 16:39:37 +0000 |
parents | 82393badfa24 |
children | 5488db2e9e4e 17d097fc111c |
comparison
equal
deleted
inserted
replaced
261:82393badfa24 | 329:8ed0dce45126 |
---|---|
201 if (channel->extrabuf == NULL && | 201 if (channel->extrabuf == NULL && |
202 channel->errfd >= 0 && FD_ISSET(channel->errfd, readfds)) { | 202 channel->errfd >= 0 && FD_ISSET(channel->errfd, readfds)) { |
203 send_msg_channel_data(channel, 1, SSH_EXTENDED_DATA_STDERR); | 203 send_msg_channel_data(channel, 1, SSH_EXTENDED_DATA_STDERR); |
204 } | 204 } |
205 | 205 |
206 /* if we can read from the writefd, it might be closed, so we try to | |
207 * see if it has errors */ | |
208 if (channel->writefd >= 0 && channel->writefd != channel->readfd | |
209 && FD_ISSET(channel->writefd, readfds)) { | |
210 if (channel->initconn) { | |
211 /* Handling for "in progress" connection - this is needed | |
212 * to avoid spinning 100% CPU when we connect to a server | |
213 * which doesn't send anything (tcpfwding) */ | |
214 checkinitdone(channel); | |
215 continue; /* Important not to use the channel after | |
216 checkinitdone(), as it may be NULL */ | |
217 } | |
218 ret = write(channel->writefd, NULL, 0); /* Fake write */ | |
219 if (ret < 0 && errno != EINTR && errno != EAGAIN) { | |
220 closewritefd(channel); | |
221 } | |
222 } | |
223 | |
206 /* write to program/pipe stdin */ | 224 /* write to program/pipe stdin */ |
207 if (channel->writefd >= 0 && FD_ISSET(channel->writefd, writefds)) { | 225 if (channel->writefd >= 0 && FD_ISSET(channel->writefd, writefds)) { |
208 if (channel->initconn) { | 226 if (channel->initconn) { |
209 checkinitdone(channel); | 227 checkinitdone(channel); |
210 continue; /* Important not to use the channel after | 228 continue; /* Important not to use the channel after |
425 if (channel->extrabuf == NULL && channel->errfd >= 0) { | 443 if (channel->extrabuf == NULL && channel->errfd >= 0) { |
426 FD_SET(channel->errfd, readfds); | 444 FD_SET(channel->errfd, readfds); |
427 } | 445 } |
428 } | 446 } |
429 | 447 |
430 /* Stuff from the wire */ | 448 /* For checking FD status (ie closure etc) - we don't actually |
449 * read data from writefd */ | |
450 TRACE(("writefd = %d, readfd %d, errfd %d, bufused %d", | |
451 channel->writefd, channel->readfd, | |
452 channel->errfd, | |
453 cbuf_getused(channel->writebuf) )) | |
454 if (channel->writefd >= 0 && channel->writefd != channel->readfd) { | |
455 FD_SET(channel->writefd, readfds); | |
456 } | |
457 | |
458 /* Stuff from the wire, to local program/shell/user etc */ | |
431 if ((channel->writefd >= 0 && cbuf_getused(channel->writebuf) > 0 ) | 459 if ((channel->writefd >= 0 && cbuf_getused(channel->writebuf) > 0 ) |
432 || channel->initconn) { | 460 || channel->initconn) { |
433 | 461 |
434 FD_SET(channel->writefd, writefds); | 462 FD_SET(channel->writefd, writefds); |
435 } | 463 } |