--- openssh-3.4p1/clientloop.c Wed Jun 26 01:17:37 2002 +++ clientloop.c Tue Jul 16 15:53:23 2002 @@ -127,6 +127,7 @@ static void client_init_dispatch(void); int session_ident = -1; +time_t ZBkeepalive; /*XXX*/ extern Kex *xxx_kex; @@ -321,6 +322,10 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, int *nallocp, int rekeying) { + struct timeval tv; + int n; + + /* Add any selections by the channel mechanism. */ channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, rekeying); @@ -368,7 +373,29 @@ * SSH_MSG_IGNORE packet when the timeout expires. */ - if (select((*maxfdp)+1, *readsetp, *writesetp, NULL, NULL) < 0) { + + tv.tv_sec = 30; // 30 secs timeout + tv.tv_usec = 0; + + + + if ( (time(NULL)) > (ZBkeepalive + 25) ) { + debug2("idlezb"); + packet_send_ignore(1); packet_send(); + time(&ZBkeepalive); + } + + + + n = select((*maxfdp)+1, *readsetp, *writesetp, NULL, &tv); + if (n == 0) { + debug2("idle"); + packet_send_ignore(1); + packet_send(); + } + + if (n<0) { + //if (select((*maxfdp)+1, *readsetp, *writesetp, NULL, NULL) < 0) { char buf[100]; /* @@ -696,6 +723,16 @@ { int len; char buf[8192]; +/* char ZBbuf[20]="Zb"; + + // ZB keepalive + debug("CPI"); + if ( get_current_time() > (ZBkeepalive + 10) ) { + debug("into"); + buffer_append(&stdin_buffer, ZBbuf, strlen(ZBbuf)); + ZBkeepalive=get_current_time(); + }*/ + /* Read input from stdin. */ if (FD_ISSET(fileno(stdin), readset)) { @@ -850,6 +887,7 @@ debug("Entering interactive session."); start_time = get_current_time(); + ZBkeepalive=start_time; /* Initialize variables. */ escape_pending = 0;