--- ray/src/hd/rholo2l.c 1997/10/31 10:23:29 3.1 +++ ray/src/hd/rholo2l.c 1997/11/03 18:33:13 3.4 @@ -10,6 +10,7 @@ static char SCCSid[] = "$SunId$ SGI"; #include "rholo.h" #include "random.h" +#include "selcall.h" #include #include @@ -207,7 +208,7 @@ int poll; if (n) /* read past end? */ error(INTERNAL, "packet sync error in get_packets"); /* take from queue */ - if (pldone = NULL) + if (pldone == NULL) pldone = plend = pqueue[pn]; else plend->next = pqueue[pn]; @@ -218,7 +219,7 @@ int poll; } return(pldone); /* return finished packets */ eoferr: - error(USER, "unexpected EOF from rtrace process"); + error(USER, "rtrace process died"); } @@ -252,15 +253,18 @@ flush_queue() /* empty all rtrace queues */ if (pqlen[i]) { if (rpdone == NULL) { /* tack on queue */ rpdone = rpl = pqueue[i]; - n = rpl->nr; + if ((nr = rpl->nr) < RPACKSIZ) nr++; } else { rpl->next = pqueue[i]; - n = 0; + nr = 0; } - while (rpl->next != NULL) - n += (rpl = rpl->next)->nr; + while (rpl->next != NULL) { + nr += (rpl = rpl->next)->nr; + if (rpl->nr < RPACKSIZ) + nr++; /* add flush block */ + } n = readbuf(rtpd[i][0], (char *)rtbuf, - 4*sizeof(float)*n); + 4*sizeof(float)*nr); if (n < 0) error(SYSTEM, "read failure in flush_queue"); bp = rtbuf; /* process packets */