From 2b8b283ae37ee7f1a89b24612a0dc25ca75a448f Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 4 Aug 1990 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1990-08-04 --- gnot/sturp.c | 14 +++++++------- port/sturp.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gnot/sturp.c b/gnot/sturp.c index aaca87531cc68261dde93fa24ebdf95ee0c89643..5902d1f4c176f22ee08ab14b7755504a1396f6dc 100644 --- a/gnot/sturp.c +++ b/gnot/sturp.c @@ -943,7 +943,11 @@ todo(void *arg) Urp *up; up = (Urp *)arg; - return (WINDOW(up)>0 && up->wq->len>0 && !(up->state&INITING)); + + return (up->state&INITING) + ? NOW>up->timer /* time to INIT1 */ + : ((up->unacked!=up->next && NOW>up->timer) /* time to ENQ */ + || (!QFULL(up->rq->next) && up->iseq!=(up->lastecho&7))); /* time to ECHO */ } static void urpkproc(void *arg) @@ -970,7 +974,6 @@ urpkproc(void *arg) up->kstarted = 0; wakeup(&up->r); poperror(); - DPRINT("urpkproc %ux\n", up); } /* @@ -988,11 +991,8 @@ urptimer(Alarm *a) for(up = urp, last = &urp[conf.nurp]; up < last; up++){ if(up->state==0) continue; - if((up->unacked!=up->next || (up->state&INITING)) && NOW>up->timer){ - q = up->rq; - if(q) - wakeup(&q->r); - } + if(up->rq && todo(up)) + wakeup(&up->rq->r); } } diff --git a/port/sturp.c b/port/sturp.c index aaca87531cc68261dde93fa24ebdf95ee0c89643..5902d1f4c176f22ee08ab14b7755504a1396f6dc 100644 --- a/port/sturp.c +++ b/port/sturp.c @@ -943,7 +943,11 @@ todo(void *arg) Urp *up; up = (Urp *)arg; - return (WINDOW(up)>0 && up->wq->len>0 && !(up->state&INITING)); + + return (up->state&INITING) + ? NOW>up->timer /* time to INIT1 */ + : ((up->unacked!=up->next && NOW>up->timer) /* time to ENQ */ + || (!QFULL(up->rq->next) && up->iseq!=(up->lastecho&7))); /* time to ECHO */ } static void urpkproc(void *arg) @@ -970,7 +974,6 @@ urpkproc(void *arg) up->kstarted = 0; wakeup(&up->r); poperror(); - DPRINT("urpkproc %ux\n", up); } /* @@ -988,11 +991,8 @@ urptimer(Alarm *a) for(up = urp, last = &urp[conf.nurp]; up < last; up++){ if(up->state==0) continue; - if((up->unacked!=up->next || (up->state&INITING)) && NOW>up->timer){ - q = up->rq; - if(q) - wakeup(&q->r); - } + if(up->rq && todo(up)) + wakeup(&up->rq->r); } }