mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
fossil: fix EOF detection when reading 9P message
When the 9P connection is closed, reads on the connection will keep returning 0. So, fossil ends up looping forever, trying to read a 9P message, consuming 100% CPU. The fix interprets 0 bytes read as EOF. Reproduce by killing the 9pserve process serving the fossil service, or by listening on tcp and using 9p(1).
This commit is contained in:
parent
23420c2493
commit
2ca8ede24a
1 changed files with 2 additions and 3 deletions
|
@ -362,9 +362,8 @@ msgRead(void* v)
|
|||
while(!eof){
|
||||
m = msgAlloc(con);
|
||||
|
||||
while((n = read9pmsg(fd, m->data, con->msize)) == 0)
|
||||
;
|
||||
if(n < 0){
|
||||
n = read9pmsg(fd, m->data, con->msize);
|
||||
if(n <= 0){
|
||||
m->t.type = Tversion;
|
||||
m->t.fid = NOFID;
|
||||
m->t.tag = NOTAG;
|
||||
|
|
Loading…
Reference in a new issue