diff options
author | brian <brian@FreeBSD.org> | 1999-03-30 00:44:57 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-03-30 00:44:57 +0000 |
commit | e9c44757c375afcb9faf84f23607abb1a92494e5 (patch) | |
tree | aa9b7363acb539fc8b70775c99982dae645d6344 /usr.sbin/ppp/main.c | |
parent | 6b64c5f82731e7fdc2065707f878a7e75ed76152 (diff) | |
download | FreeBSD-src-e9c44757c375afcb9faf84f23607abb1a92494e5.zip FreeBSD-src-e9c44757c375afcb9faf84f23607abb1a92494e5.tar.gz |
Maintain a `necessary' marker to indicate that we *probably*
need to process a signal (usually a SIGALRM). Check to see
if we need to process a signal both before *and* after calling
select() as older (pre-2.0) versions of ppp used to.
This handles the possibility that ppp may block at some
point (maybe due to an open() of a misconfigured device).
Previously, we'd potentially lock up in select().
The `necessary' marker reduces the increased signal checking
overhead so that at full speed with no compression transferring
an 83Mb file via a ``!ppp -direct'' device, we get a 1%
throughput gain.
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r-- | usr.sbin/ppp/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 958a16d..4eb99d4 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.150 1999/02/06 02:54:46 brian Exp $ + * $Id: main.c,v 1.151 1999/03/07 01:02:38 brian Exp $ * * TODO: */ @@ -474,6 +474,17 @@ DoLoop(struct bundle *bundle) /* Don't select - we'll be here forever */ break; + /* + * It's possible that we've had a signal since we last checked. If + * we don't check again before calling select(), we may end up stuck + * after having missed the event.... sig_Handle() tries to be as + * quick as possible if nothing is likely to have happened. + * This is only really likely if we block in open(... O_NONBLOCK) + * which will happen with a misconfigured device. + */ + if (sig_Handle()) + continue; + i = select(nfds, &rfds, &wfds, &efds, NULL); if (i < 0 && errno != EINTR) { |