comparison common-channel.c @ 1074:10f198d4a308

Make main socket nonblocking. Limit writequeue size.
author Matt Johnston <matt@ucc.asn.au>
date Fri, 20 Mar 2015 23:36:42 +0800
parents 686cd3e8e13e
children cc6116cc0b5c
comparison
equal deleted inserted replaced
1073:88043f9d40bd 1074:10f198d4a308
529 TRACE(("leave writechannel")) 529 TRACE(("leave writechannel"))
530 } 530 }
531 531
532 /* Set the file descriptors for the main select in session.c 532 /* Set the file descriptors for the main select in session.c
533 * This avoid channels which don't have any window available, are closed, etc*/ 533 * This avoid channels which don't have any window available, are closed, etc*/
534 void setchannelfds(fd_set *readfds, fd_set *writefds) { 534 void setchannelfds(fd_set *readfds, fd_set *writefds, int allow_reads) {
535 535
536 unsigned int i; 536 unsigned int i;
537 struct Channel * channel; 537 struct Channel * channel;
538 538
539 for (i = 0; i < ses.chansize; i++) { 539 for (i = 0; i < ses.chansize; i++) {
547 Avoid queueing data to send if we're in the middle of a 547 Avoid queueing data to send if we're in the middle of a
548 key re-exchange (!dataallowed), but still read from the 548 key re-exchange (!dataallowed), but still read from the
549 FD if there's the possibility of "~."" to kill an 549 FD if there's the possibility of "~."" to kill an
550 interactive session (the read_mangler) */ 550 interactive session (the read_mangler) */
551 if (channel->transwindow > 0 551 if (channel->transwindow > 0
552 && (ses.dataallowed || channel->read_mangler)) { 552 && ((ses.dataallowed && allow_reads) || channel->read_mangler)) {
553 553
554 if (channel->readfd >= 0) { 554 if (channel->readfd >= 0) {
555 FD_SET(channel->readfd, readfds); 555 FD_SET(channel->readfd, readfds);
556 } 556 }
557 557