Date: Mon, 27 Feb 1995 23:27:32 -0800 (PST) From: Morgan Davis <root@io.cts.com> To: julian@tfs.com (Julian Elischer) Cc: tom@haven.uniserve.com, hackers@FreeBSD.org Subject: Re: pppd inactivity timeout? Message-ID: <199502280727.XAA05665@io.cts.com> In-Reply-To: <m0rj0r4-0003vxC@TFS.COM> from "Julian Elischer" at Feb 27, 95 00:30:58 am
next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer writes: > > >This will use a lot of cputime.. a better way would be to call > timeout every 10 seconds or minute while the line is up, and > have it decrement a counter.. if it reaches 0, you hang up. > if not you just schedule another timeout.. > whenever you receive or send a packet, you just set the counter > back to initial condition (maximum count).. > that way you're doing a single write, not a whole function call(x2) > for each packet. How do netstat and pppstat get their information? Isn't there a counter somewhere in the kernel that keeps track of how many bytes were sent and received? If so, the task is even easier. Set an alarm to call a function once every so often (user-defined) and see if the sent/received counts match. If so, poof -- blow the connection off. If they're different, do nothing and reset the alarm.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199502280727.XAA05665>