Deleted Added
full compact
main.c (81697) main.c (93418)
1/*-
2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4 * Internet Initiative Japan, Inc (IIJ)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4 * Internet Initiative Japan, Inc (IIJ)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/usr.sbin/ppp/main.c 81697 2001-08-15 13:53:38Z brian $
28 * $FreeBSD: head/usr.sbin/ppp/main.c 93418 2002-03-30 12:30:09Z brian $
29 */
30
31#include <sys/param.h>
32#include <netinet/in.h>
33#include <netinet/in_systm.h>
34#include <netinet/ip.h>
35#include <sys/un.h>
36#include <sys/socket.h>

--- 611 unchanged lines hidden (view full) ---

648 }
649
650 if (descriptor_IsSet(&bundle->desc, rfds)) {
651 descriptor_Read(&bundle->desc, bundle, rfds);
652 nothing_done = 0;
653 }
654
655 if (descriptor_IsSet(&bundle->desc, wfds))
29 */
30
31#include <sys/param.h>
32#include <netinet/in.h>
33#include <netinet/in_systm.h>
34#include <netinet/ip.h>
35#include <sys/un.h>
36#include <sys/socket.h>

--- 611 unchanged lines hidden (view full) ---

648 }
649
650 if (descriptor_IsSet(&bundle->desc, rfds)) {
651 descriptor_Read(&bundle->desc, bundle, rfds);
652 nothing_done = 0;
653 }
654
655 if (descriptor_IsSet(&bundle->desc, wfds))
656 if (!descriptor_Write(&bundle->desc, bundle, wfds) && nothing_done) {
656 if (descriptor_Write(&bundle->desc, bundle, wfds) <= 0 && nothing_done) {
657 /*
657 /*
658 * This is disasterous. The OS has told us that something is
658 * This is disastrous. The OS has told us that something is
659 * writable, and all our write()s have failed. Rather than
660 * going back immediately to do our UpdateSet()s and select(),
661 * we sleep for a bit to avoid gobbling up all cpu time.
662 */
663 struct timeval t;
664
665 t.tv_sec = 0;
666 t.tv_usec = 100000;
667 select(0, NULL, NULL, NULL, &t);
668 }
669 }
670
671 log_Printf(LogDEBUG, "DoLoop done.\n");
672}
659 * writable, and all our write()s have failed. Rather than
660 * going back immediately to do our UpdateSet()s and select(),
661 * we sleep for a bit to avoid gobbling up all cpu time.
662 */
663 struct timeval t;
664
665 t.tv_sec = 0;
666 t.tv_usec = 100000;
667 select(0, NULL, NULL, NULL, &t);
668 }
669 }
670
671 log_Printf(LogDEBUG, "DoLoop done.\n");
672}