summaryrefslogtreecommitdiff
path: root/slirp/tcp_timer.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-26 19:01:16 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-26 19:01:16 +0000
commit9634d9031c140b24c7ca0d8872632207f6ce7275 (patch)
tree34ba241de1f12fcbd4e3301f081c50ff2db654da /slirp/tcp_timer.c
parent31a60e22752d3daaa248ca10930f3cf4bc5f02e8 (diff)
downloadqemu-9634d9031c140b24c7ca0d8872632207f6ce7275.tar.gz
Use const and static as needed, disable unused code
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/tcp_timer.c')
-rw-r--r--slirp/tcp_timer.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c
index 3e865977ce..244bad6a8f 100644
--- a/slirp/tcp_timer.c
+++ b/slirp/tcp_timer.c
@@ -36,17 +36,14 @@
#include <slirp.h>
-int tcp_keepidle = TCPTV_KEEP_IDLE;
-int tcp_keepintvl = TCPTV_KEEPINTVL;
-int tcp_maxidle;
-int so_options = DO_KEEPALIVE;
-
#ifdef LOG_ENABLED
struct tcpstat tcpstat; /* tcp statistics */
#endif
u_int32_t tcp_now; /* for RFC 1323 timestamps */
+static struct tcpcb *tcp_timers(register struct tcpcb *tp, int timer);
+
/*
* Fast timeout routine for processing delayed acks
*/
@@ -84,7 +81,6 @@ tcp_slowtimo()
DEBUG_CALL("tcp_slowtimo");
- tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl;
/*
* Search through tcb's and update active timers.
*/
@@ -130,16 +126,14 @@ tcp_canceltimers(tp)
tp->t_timer[i] = 0;
}
-int tcp_backoff[TCP_MAXRXTSHIFT + 1] =
+const int tcp_backoff[TCP_MAXRXTSHIFT + 1] =
{ 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };
/*
* TCP timer processing.
*/
-struct tcpcb *
-tcp_timers(tp, timer)
- register struct tcpcb *tp;
- int timer;
+static struct tcpcb *
+tcp_timers(register struct tcpcb *tp, int timer)
{
register int rexmt;
@@ -155,8 +149,8 @@ tcp_timers(tp, timer)
*/
case TCPT_2MSL:
if (tp->t_state != TCPS_TIME_WAIT &&
- tp->t_idle <= tcp_maxidle)
- tp->t_timer[TCPT_2MSL] = tcp_keepintvl;
+ tp->t_idle <= TCP_MAXIDLE)
+ tp->t_timer[TCPT_2MSL] = TCPTV_KEEPINTVL;
else
tp = tcp_close(tp);
break;
@@ -287,8 +281,8 @@ tcp_timers(tp, timer)
goto dropit;
/* if (tp->t_socket->so_options & SO_KEEPALIVE && */
- if ((so_options) && tp->t_state <= TCPS_CLOSE_WAIT) {
- if (tp->t_idle >= tcp_keepidle + tcp_maxidle)
+ if ((SO_OPTIONS) && tp->t_state <= TCPS_CLOSE_WAIT) {
+ if (tp->t_idle >= TCPTV_KEEP_IDLE + TCP_MAXIDLE)
goto dropit;
/*
* Send a packet designed to force a response
@@ -314,9 +308,9 @@ tcp_timers(tp, timer)
tcp_respond(tp, &tp->t_template, (struct mbuf *)NULL,
tp->rcv_nxt, tp->snd_una - 1, 0);
#endif
- tp->t_timer[TCPT_KEEP] = tcp_keepintvl;
+ tp->t_timer[TCPT_KEEP] = TCPTV_KEEPINTVL;
} else
- tp->t_timer[TCPT_KEEP] = tcp_keepidle;
+ tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_IDLE;
break;
dropit: