version 1.55, 2001/04/04 14:34:58 |
version 1.56, 2001/04/04 20:25:37 |
|
|
static u_int buffer_high;/* Soft max buffer size. */ |
static u_int buffer_high;/* Soft max buffer size. */ |
static int connection_in; /* Connection to server (input). */ |
static int connection_in; /* Connection to server (input). */ |
static int connection_out; /* Connection to server (output). */ |
static int connection_out; /* Connection to server (output). */ |
|
static int need_rekeying; /* Set to non-zero if rekeying is requested. */ |
|
|
void client_init_dispatch(void); |
void client_init_dispatch(void); |
int session_ident = -1; |
int session_ident = -1; |
|
|
|
|
void |
void |
client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, |
client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, |
int *maxfdp) |
int *maxfdp, int rekeying) |
{ |
{ |
/* Add any selections by the channel mechanism. */ |
/* Add any selections by the channel mechanism. */ |
channel_prepare_select(readsetp, writesetp, maxfdp); |
channel_prepare_select(readsetp, writesetp, maxfdp, rekeying); |
|
|
if (!compat20) { |
if (!compat20) { |
/* Read from the connection, unless our buffers are full. */ |
/* Read from the connection, unless our buffers are full. */ |
|
|
continue; |
continue; |
|
|
case 'R': |
case 'R': |
debug("Rekeying"); |
if (compat20) |
kex_send_kexinit(xxx_kex); |
need_rekeying = 1; |
continue; |
continue; |
|
|
case '&': |
case '&': |
|
|
client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) |
client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) |
{ |
{ |
fd_set *readset = NULL, *writeset = NULL; |
fd_set *readset = NULL, *writeset = NULL; |
int max_fd = 0; |
|
double start_time, total_time; |
double start_time, total_time; |
int len; |
int max_fd = 0, len, rekeying = 0; |
char buf[100]; |
char buf[100]; |
|
|
debug("Entering interactive session."); |
debug("Entering interactive session."); |
|
|
/* Process buffered packets sent by the server. */ |
/* Process buffered packets sent by the server. */ |
client_process_buffered_input_packets(); |
client_process_buffered_input_packets(); |
|
|
|
rekeying = (xxx_kex != NULL && !xxx_kex->done); |
|
|
if (compat20 && !channel_still_open()) { |
if (compat20 && !channel_still_open()) { |
debug2("!channel_still_open."); |
debug2("!channel_still_open."); |
break; |
break; |
} |
} |
|
|
/* |
if (rekeying) { |
* Make packets of buffered stdin data, and buffer them for |
debug("rekeying in progress"); |
* sending to the server. |
} else { |
*/ |
/* |
if (!compat20) |
* Make packets of buffered stdin data, and buffer |
client_make_packets_from_stdin_data(); |
* them for sending to the server. |
|
*/ |
|
if (!compat20) |
|
client_make_packets_from_stdin_data(); |
|
|
/* |
/* |
* Make packets from buffered channel data, and enqueue them |
* Make packets from buffered channel data, and |
* for sending to the server. |
* enqueue them for sending to the server. |
*/ |
*/ |
if (packet_not_very_much_data_to_write()) |
if (packet_not_very_much_data_to_write()) |
channel_output_poll(); |
channel_output_poll(); |
|
|
/* |
/* |
* Check if the window size has changed, and buffer a message |
* Check if the window size has changed, and buffer a |
* about it to the server if so. |
* message about it to the server if so. |
*/ |
*/ |
client_check_window_change(); |
client_check_window_change(); |
|
|
if (quit_pending) |
if (quit_pending) |
break; |
break; |
|
} |
/* |
/* |
* Wait until we have something to do (something becomes |
* Wait until we have something to do (something becomes |
* available on one of the descriptors). |
* available on one of the descriptors). |
*/ |
*/ |
client_wait_until_can_do_something(&readset, &writeset, &max_fd); |
client_wait_until_can_do_something(&readset, &writeset, |
|
&max_fd, rekeying); |
|
|
if (quit_pending) |
if (quit_pending) |
break; |
break; |
|
|
/* Do channel operations. */ |
/* Do channel operations unless rekeying in progress. */ |
channel_after_select(readset, writeset); |
if (!rekeying) { |
|
channel_after_select(readset, writeset); |
|
|
|
if (need_rekeying) { |
|
debug("user requests rekeying"); |
|
xxx_kex->done = 0; |
|
kex_send_kexinit(xxx_kex); |
|
need_rekeying = 0; |
|
} |
|
} |
|
|
/* Buffer input from the connection. */ |
/* Buffer input from the connection. */ |
client_process_net_input(readset); |
client_process_net_input(readset); |