- /* Finished a packet */
- sc->sc_outm = NULL;
- sc->sc_bytessent++; /* account for closing flag */
- sc->sc_if.if_opackets++;
+ /*
+ * Here we have either finished a packet (m == NULL)
+ * or filled up the output queue (m != NULL).
+ */
+ sc->sc_outm = m;
+ if (m)
+ break;
+ }
+
+ /*
+ * If there is stuff in the output queue, send it now.
+ * We are being called in lieu of ttstart and must do what it would.
+ */
+ if (tp->t_oproc != NULL)
+ (*tp->t_oproc)(tp);
+
+ /*
+ * This timeout is needed for operation on a pseudo-tty,
+ * because the pty code doesn't call pppstart after it has
+ * drained the t_outq.
+ */
+ if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) {
+ timeout(ppp_timeout, (void *) sc, 1);
+ sc->sc_flags |= SC_TIMEOUT;