]> git.lizzy.rs Git - plan9front.git/commitdiff
qio: naive fixing attempt on issue #64
authorcinap_lenrek <cinap_lenrek@localhost>
Sat, 9 Jul 2011 11:15:39 +0000 (13:15 +0200)
committercinap_lenrek <cinap_lenrek@localhost>
Sat, 9 Jul 2011 11:15:39 +0000 (13:15 +0200)
sys/src/9/port/qio.c

index 76b04be2bb12971d32ccf859e8ff28691a955e28..aa4de59f376465786a2e0a6f73aa6da0ddc39f1b 100644 (file)
@@ -1156,8 +1156,6 @@ qnotfull(void *a)
        return q->len < q->limit || (q->state & Qclosed);
 }
 
-ulong noblockcnt;
-
 /*
  *  add a block to a queue obeying flow control
  */
@@ -1191,16 +1189,19 @@ qbwrite(Queue *q, Block *b)
                error(q->err);
        }
 
-       /* if nonblocking, don't queue over the limit */
+       /* don't queue over the limit */
        if(q->len >= q->limit){
                if(q->noblock){
                        iunlock(q);
                        freeb(b);
-                       noblockcnt += n;
                        qunlock(&q->wlock);
                        poperror();
                        return n;
                }
+               if(q->len >= q->limit*2){
+                       iunlock(q);
+                       error(Egreg);
+               }
        }
 
        /* queue the block */