@@ -534,9 +534,16 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd,
534534 (c -> output = sshbuf_new ()) == NULL ||
535535 (c -> extended = sshbuf_new ()) == NULL )
536536 fatal_f ("sshbuf_new failed" );
537+
538+ /* these buffers are important in terms of tracking channel
539+ * buffer usage so label and type them with descriptive names */
537540 sshbuf_relabel (c -> input , "channel input" );
541+ sshbuf_type (c -> input , BUF_CHANNEL_INPUT );
538542 sshbuf_relabel (c -> output , "channel output" );
543+ sshbuf_type (c -> output , BUF_CHANNEL_OUTPUT );
539544 sshbuf_relabel (c -> extended , "channel extended" );
545+ sshbuf_type (c -> extended , BUF_CHANNEL_EXTENDED );
546+
540547 if ((r = sshbuf_set_max_size (c -> input , CHAN_INPUT_MAX )) != 0 )
541548 fatal_fr (r , "sshbuf_set_max_size" );
542549 c -> ostate = CHAN_OUTPUT_OPEN ;
@@ -2401,40 +2408,20 @@ channel_check_window(struct ssh *ssh, Channel *c)
24012408{
24022409 int r ;
24032410
2404- /* going back to a set denominator of 2. Prior versions had a
2405- * dynamic denominator based on the size of the buffer. This may
2406- * have been helpful in some situations but it isn't helping in
2407- * the general case -cjr 6/30/23 */
24082411 if (c -> type == SSH_CHANNEL_OPEN &&
24092412 !(c -> flags & (CHAN_CLOSE_SENT |CHAN_CLOSE_RCVD )) &&
24102413 ((c -> local_window_max - c -> local_window > c -> local_maxpacket * 3 ) ||
24112414 c -> local_window < c -> local_window_max /2 ) &&
24122415 c -> local_consumed > 0 ) {
2413- u_int addition = 0 ;
2416+ int addition = 0 ;
24142417 u_int32_t tcpwinsz = channel_tcpwinsz (ssh );
24152418 /* adjust max window size if we are in a dynamic environment
24162419 * and the tcp receive buffer is larger than the ssh window */
24172420 if (c -> dynamic_window && (tcpwinsz > c -> local_window_max )) {
2418- if (c -> hpn_buffer_limit ) {
2419- /* limit window growth to prevent buffer issues
2420- * still not sure what is causing the buffer issues
2421- * but it may be an issue with c->local_consumed not being
2422- * handled properly in the cases of bottenecked IO to the
2423- * wfd endpoint. This does have an impact on throughput
2424- * as we're essentially maxing out local_window_max to
2425- * half of the window size */
2426- addition = (tcpwinsz /2 - c -> local_window_max );
2427- }
2428- else {
2429- /* aggressively grow the window */
2430- addition = tcpwinsz - c -> local_window_max ;
2431- }
2421+ /* aggressively grow the window */
2422+ addition = tcpwinsz - c -> local_window_max ;
24322423 c -> local_window_max += addition ;
2433- /* doesn't look like we need these
2434- * sshbuf_set_window_max(c->output, c->local_window_max);
2435- * sshbuf_set_window_max(c->input, c->local_window_max);
2436- */
2437- debug ("Channel %d: Window growth to %d by %d bytes" ,c -> self ,
2424+ debug_f ("Channel %d: Window growth to %d by %d bytes" ,c -> self ,
24382425 c -> local_window_max , addition );
24392426 }
24402427 if (!c -> have_remote_id )
0 commit comments