From 957ee47817249ac0bf155ec1542f81577bb4b97f Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 23 Feb 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-02-23 --- port/devdk.c | 5 ++--- port/devip.c | 2 ++ port/tcpif.c | 10 ++++++---- port/tcpoutput.c | 2 ++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/port/devdk.c b/port/devdk.c index f9d8358e754a06b7523b9adaaf3f6e982cf5a38c..9bb0a5cd8692959b215c3c4e9b63ec3f55887523 100644 --- a/port/devdk.c +++ b/port/devdk.c @@ -308,8 +308,7 @@ dkalloc(char *name, int ncsc, int lines) } /* - * a new dkmux. find a free dk structure and assign it to this queue. - * when we get though here dp->s is meaningful and the name is set to "/". + * a new dkmux. hold the stream in place so it can never be closed down. */ static void dkmuxopen(Queue *q, Stream *s) @@ -322,7 +321,7 @@ dkmuxopen(Queue *q, Stream *s) } /* - * close down a dkmux + * close down a dkmux, this shouldn't happen */ static void dkmuxclose(Queue *q) diff --git a/port/devip.c b/port/devip.c index e9a6890f51e5e3764de3c5cbe374efdec9428f9d..b947764b6a140cb021ea7e89c65c7bfcada72c04 100644 --- a/port/devip.c +++ b/port/devip.c @@ -663,7 +663,9 @@ tcpstclose(Queue *q) tcb = &s->tcpctl; /* Not interested in data anymore */ + qlock(s); s->readq = 0; + qunlock(s); switch(tcb->state){ case Closed: diff --git a/port/tcpif.c b/port/tcpif.c index 494ac5de9e0c9df988e94560bba549f651b3577a..8b22d7971b2601d3f87897bab0b5a72b415ea577 100644 --- a/port/tcpif.c +++ b/port/tcpif.c @@ -29,9 +29,6 @@ state_upcall(Ipconv *s, char oldstate, char newstate) s->dst = 0; /* NO break */ case Close_wait: /* Remote closes */ - if(s->readq == 0) - break; - if(s->err) { len = strlen(s->err); bp = allocb(len); @@ -43,7 +40,12 @@ state_upcall(Ipconv *s, char oldstate, char newstate) bp->flags |= S_DELIM; bp->type = M_HANGUP; - PUTNEXT(s->readq, bp); + qlock(s); + if(s->readq == 0) + freeb(bp); + else + PUTNEXT(s->readq, bp); + qunlock(s); break; } } diff --git a/port/tcpoutput.c b/port/tcpoutput.c index b3369e834e11bd23f472a1677795cd09c4858c83..23d7589351a8c0f454479ea97109e2ab9c8d1277 100644 --- a/port/tcpoutput.c +++ b/port/tcpoutput.c @@ -239,6 +239,7 @@ tcprcvwin(Ipconv *s) Tcpctl *tcb = &s->tcpctl; /* Calculate new window */ + qlock(s); if(s->readq) { tcb->rcv.wnd = Streamhi - s->readq->next->len; if(tcb->rcv.wnd < 0) @@ -246,6 +247,7 @@ tcprcvwin(Ipconv *s) } else tcb->rcv.wnd = Streamhi; + qunlock(s); } /*