diff options
author | Kacheong Poon <Kacheong.Poon@Sun.COM> | 2010-07-19 17:27:45 -0700 |
---|---|---|
committer | Kacheong Poon <Kacheong.Poon@Sun.COM> | 2010-07-19 17:27:45 -0700 |
commit | 5dd46ab5742d7db1cbb08dec7b64fa14930c02f7 (patch) | |
tree | 290ef9de55b79f9edcc6e99d8c023e66a7658133 /usr/src/uts/common/inet/tcp/tcp_timers.c | |
parent | 516aa12c0e0be4dde28b9fc2b3d928230a8e4c42 (diff) | |
download | illumos-joyent-5dd46ab5742d7db1cbb08dec7b64fa14930c02f7.tar.gz |
6910078 SCTP should have similar memory handling mechanism as TCP
Diffstat (limited to 'usr/src/uts/common/inet/tcp/tcp_timers.c')
-rw-r--r-- | usr/src/uts/common/inet/tcp/tcp_timers.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/usr/src/uts/common/inet/tcp/tcp_timers.c b/usr/src/uts/common/inet/tcp/tcp_timers.c index d0e0401857..c883be8cfd 100644 --- a/usr/src/uts/common/inet/tcp/tcp_timers.c +++ b/usr/src/uts/common/inet/tcp/tcp_timers.c @@ -695,14 +695,18 @@ tcp_timer(void *arg) first_threshold = tcp->tcp_first_ctimer_threshold; second_threshold = tcp->tcp_second_ctimer_threshold; - /* Retransmit forever unless this is a passive open... */ + /* + * If an app has set the second_threshold to 0, it means that + * we need to retransmit forever, unless this is a passive + * open. We need to set second_threshold back to a normal + * value such that later comparison with it still makes + * sense. But we set dont_timeout to B_TRUE so that we will + * never time out. + */ if (second_threshold == 0) { - if (!tcp->tcp_active_open) { - second_threshold = - tcps->tcps_ip_abort_linterval; - } else { + second_threshold = tcps->tcps_ip_abort_linterval; + if (tcp->tcp_active_open) dont_timeout = B_TRUE; - } } break; case TCPS_ESTABLISHED: @@ -712,8 +716,10 @@ tcp_timer(void *arg) * forever. But if the end point is closed, the normal * timeout applies. */ - if (second_threshold == 0) + if (second_threshold == 0) { + second_threshold = tcps->tcps_ip_abort_linterval; dont_timeout = B_TRUE; + } /* FALLTHRU */ case TCPS_FIN_WAIT_1: case TCPS_CLOSING: @@ -892,8 +898,7 @@ tcp_timer(void *arg) dont_timeout = B_FALSE; } - if (!dont_timeout && second_threshold == 0) - second_threshold = tcps->tcps_ip_abort_interval; + ASSERT(second_threshold != 0); if ((ms = tcp->tcp_ms_we_have_waited) > second_threshold) { /* @@ -903,8 +908,14 @@ tcp_timer(void *arg) tcp->tcp_xmit_head = tcp_zcopy_backoff(tcp, tcp->tcp_xmit_head, B_TRUE); - if (dont_timeout) + if (dont_timeout) { + /* + * Reset tcp_ms_we_have_waited to avoid overflow since + * we are going to retransmit forever. + */ + tcp->tcp_ms_we_have_waited = second_threshold; goto timer_rexmit; + } /* * For zero window probe, we need to send indefinitely, |