diff options
author | brian <brian@FreeBSD.org> | 1998-06-24 19:33:36 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-06-24 19:33:36 +0000 |
commit | 7c567ca3f8ef3ab5a1e088fbf86a9b1cd2e6718e (patch) | |
tree | cb27c2021e7933ab6a8a0c8a33e27883241617a8 /usr.sbin/ppp/chat.c | |
parent | be4ceaedbf3a7a77628a0d38a412cd66fbcab341 (diff) | |
download | FreeBSD-src-7c567ca3f8ef3ab5a1e088fbf86a9b1cd2e6718e.zip FreeBSD-src-7c567ca3f8ef3ab5a1e088fbf86a9b1cd2e6718e.tar.gz |
o If we come out of select() with only write descriptors that
end up writing zero bytes, sleep for 1/10 of a second so that
we don't end up using up too much cpu.
This should only ever happen on systems that wrongly report a
descriptor as writable despite the tty buffer being full.
Discussed with: Jeff Evarts
o Do an initial run-time check to see if select() alters the passed
timeval. This knowledge isn't yet used, but will be soon.
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r-- | usr.sbin/ppp/chat.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index 662b7fd..353bf77 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: chat.c,v 1.47 1998/05/28 23:17:38 brian Exp $ + * $Id: chat.c,v 1.48 1998/06/15 19:06:38 brian Exp $ */ #include <sys/types.h> @@ -464,10 +464,11 @@ chat_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset) } } -static void +static int chat_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset) { struct chat *c = descriptor2chat(d); + int result = 0; if (c->state == CHAT_SEND) { int wrote; @@ -491,6 +492,7 @@ chat_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset) } wrote = physical_Write(c->physical, c->argptr, c->arglen); + result = wrote ? 1 : 0; if (wrote == -1) { if (errno != EINTR) log_Printf(LogERROR, "chat_Write: %s\n", strerror(errno)); @@ -507,6 +509,8 @@ chat_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset) c->arglen -= wrote; } } + + return result; } void |