Use monotonic time_uptime instead of 'time_second' as timebase
for timeouts.
This commit is contained in:
parent
9a84c48b48
commit
b2bf25e5cd
@ -373,7 +373,7 @@ pppalloc(pid)
|
||||
sc->sc_npmode[i] = NPMODE_ERROR;
|
||||
sc->sc_npqueue = NULL;
|
||||
sc->sc_npqtail = &sc->sc_npqueue;
|
||||
sc->sc_last_sent = sc->sc_last_recv = time_second;
|
||||
sc->sc_last_sent = sc->sc_last_recv = time_uptime;
|
||||
|
||||
return sc;
|
||||
}
|
||||
@ -601,7 +601,7 @@ pppioctl(sc, cmd, data, flag, td)
|
||||
|
||||
case PPPIOCGIDLE:
|
||||
s = splsoftnet();
|
||||
t = time_second;
|
||||
t = time_uptime;
|
||||
((struct ppp_idle *)data)->xmit_idle = t - sc->sc_last_sent;
|
||||
((struct ppp_idle *)data)->recv_idle = t - sc->sc_last_recv;
|
||||
splx(s);
|
||||
@ -918,14 +918,14 @@ pppoutput(ifp, m0, dst, rtp)
|
||||
*/
|
||||
if (sc->sc_active_filt.bf_insns == 0
|
||||
|| bpf_filter(sc->sc_active_filt.bf_insns, (u_char *) m0, len, 0))
|
||||
sc->sc_last_sent = time_second;
|
||||
sc->sc_last_sent = time_uptime;
|
||||
|
||||
*mtod(m0, u_char *) = address;
|
||||
#else
|
||||
/*
|
||||
* Update the time we sent the most recent data packet.
|
||||
*/
|
||||
sc->sc_last_sent = time_second;
|
||||
sc->sc_last_sent = time_uptime;
|
||||
#endif /* PPP_FILTER */
|
||||
}
|
||||
|
||||
@ -1557,14 +1557,14 @@ ppp_inproc(sc, m)
|
||||
}
|
||||
if (sc->sc_active_filt.bf_insns == 0
|
||||
|| bpf_filter(sc->sc_active_filt.bf_insns, (u_char *) m, ilen, 0))
|
||||
sc->sc_last_recv = time_second;
|
||||
sc->sc_last_recv = time_uptime;
|
||||
|
||||
*mtod(m, u_char *) = adrs;
|
||||
#else
|
||||
/*
|
||||
* Record the time that we received this packet.
|
||||
*/
|
||||
sc->sc_last_recv = time_second;
|
||||
sc->sc_last_recv = time_uptime;
|
||||
#endif /* PPP_FILTER */
|
||||
}
|
||||
|
||||
@ -1607,7 +1607,7 @@ ppp_inproc(sc, m)
|
||||
m->m_data += PPP_HDRLEN;
|
||||
m->m_len -= PPP_HDRLEN;
|
||||
isr = NETISR_IPX;
|
||||
sc->sc_last_recv = time_second; /* update time of last pkt rcvd */
|
||||
sc->sc_last_recv = time_uptime; /* update time of last pkt rcvd */
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -876,15 +876,15 @@ slinput(int c, struct tty *tp)
|
||||
* this one is within the time limit.
|
||||
*/
|
||||
if (sc->sc_abortcount &&
|
||||
time_second >= sc->sc_starttime + ABT_WINDOW)
|
||||
time_uptime >= sc->sc_starttime + ABT_WINDOW)
|
||||
sc->sc_abortcount = 0;
|
||||
/*
|
||||
* If we see an abort after "idle" time, count it;
|
||||
* record when the first abort escape arrived.
|
||||
*/
|
||||
if (time_second >= sc->sc_lasttime + ABT_IDLE) {
|
||||
if (time_uptime >= sc->sc_lasttime + ABT_IDLE) {
|
||||
if (++sc->sc_abortcount == 1)
|
||||
sc->sc_starttime = time_second;
|
||||
sc->sc_starttime = time_uptime;
|
||||
if (sc->sc_abortcount >= ABT_COUNT) {
|
||||
slclose(tp,0);
|
||||
return 0;
|
||||
@ -892,7 +892,7 @@ slinput(int c, struct tty *tp)
|
||||
}
|
||||
} else
|
||||
sc->sc_abortcount = 0;
|
||||
sc->sc_lasttime = time_second;
|
||||
sc->sc_lasttime = time_uptime;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
|
@ -793,7 +793,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
|
||||
* packets. This is used by some subsystems to detect
|
||||
* idle lines.
|
||||
*/
|
||||
sp->pp_last_recv = time_second;
|
||||
sp->pp_last_recv = time_uptime;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1066,7 +1066,7 @@ out:
|
||||
* network-layer traffic; control-layer traffic is handled
|
||||
* by sppp_cp_send().
|
||||
*/
|
||||
sp->pp_last_sent = time_second;
|
||||
sp->pp_last_sent = time_uptime;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1104,7 +1104,7 @@ sppp_attach(struct ifnet *ifp)
|
||||
mtx_init(&sp->pp_cpq.ifq_mtx, "sppp_cpq", NULL, MTX_DEF);
|
||||
if(!mtx_initialized(&sp->pp_fastq.ifq_mtx))
|
||||
mtx_init(&sp->pp_fastq.ifq_mtx, "sppp_fastq", NULL, MTX_DEF);
|
||||
sp->pp_last_recv = sp->pp_last_sent = time_second;
|
||||
sp->pp_last_recv = sp->pp_last_sent = time_uptime;
|
||||
sp->confflags = 0;
|
||||
#ifdef INET
|
||||
sp->confflags |= CONF_ENABLE_VJ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user