- int timertype;
-{
-
-COUNT(TCP_TIMERS);
- switch (timertype) {
-
- case TFINACK: /* fin-ack timer */
- switch (tp->t_state) {
-
- case TIME_WAIT:
- /*
- * We can be sure our ACK of foreign FIN was rcvd,
- * and can close if no data left for user.
- */
- if (rcv_empty(tp)) {
- tcp_disconnect(tp);
- return (CLOSED);
- }
- return (RCV_WAIT); /* 17 */
-
- case CLOSING:
- tp->tc_flags |= TC_WAITED_2_ML;
- return (SAME);
-
- default:
- return (SAME);
- }
-
- case TREXMT: /* retransmission timer */
- if (tp->t_rexmt_val > tp->snd_una) { /* 34 */
- /*
- * Set so for a retransmission, increase rexmt time
- * in case of multiple retransmissions.
- */
- tp->snd_nxt = tp->snd_una;
- tp->tc_flags |= TC_REXMT;
- tp->t_xmtime = tp->t_xmtime << 1;
- if (tp->t_xmtime > T_REMAX)
- tp->t_xmtime = T_REMAX;
- tcp_send(tp);
- }
- return (SAME);
-
- case TREXMTTL: /* retransmit too long */
- if (tp->t_rtl_val > tp->snd_una) /* 36 */
- tcp_error(EIO); /* URXTIMO !?! */
- /*
- * If user has already closed, abort the connection.
- */
- if (tp->tc_flags & TC_USR_CLOSED) {
- tcp_abort(tp);
- return (CLOSED);
- }
- return (SAME);
-
- case TPERSIST: /* persist timer */
- /*
- * Force a byte send through closed window.
- */
- tp->tc_flags |= TC_FORCE_ONE;
- tcp_send(tp);
- return (SAME);
- }
- panic("tcp_timers");
-}
-
-tcp_sense(m)
- struct mbuf *m;
-{
-
- return (EOPNOTSUPP);
-}
-
-tcp_error(so, errno)
- struct socket *so;
- int errno;
-{
-COUNT(TO_USER);
-
- so->so_error = errno;
- sorwakeup(so);
- sowwakeup(so);
-}
-
-#ifdef TCPDEBUG
-/*
- * TCP debugging utility subroutines.
- * THE NAMES OF THE FIELDS USED BY THESE ROUTINES ARE STUPID.
- */
-tdb_setup(tp, n, input, tdp)
- struct tcpcb *tp;
- register struct tcpiphdr *n;
- int input;
- register struct tcp_debug *tdp;