commit 2c7e8d41ce377bd9de58f2b8c256e53a2e0a0c23
parent 10ce51eb5efc3595711c6f7f8f5372641cb4e610
Author: Fazlul Shahriar <none@none>
Date: Thu, 31 Jul 2008 15:49:25 -0400
9vx: return errors after enough network EOF reads, like Plan 9
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/9vx/devip.c b/src/9vx/devip.c
@@ -48,6 +48,7 @@ struct Conv
int x;
Ref r;
int sfd;
+ int eof;
int perm;
char owner[KNAMELEN];
char* state;
@@ -406,6 +407,8 @@ ipread(Chan *ch, void *a, long n, vlong offset)
oserrstr();
nexterror();
}
+ if(r == 0 && ++c->eof > 3)
+ error(Ehungup);
return r;
}
}
@@ -602,6 +605,7 @@ protoclone(Proto *p, char *user, int nfd)
c->sfd = nfd;
if(nfd == -1)
c->sfd = so_socket(p->stype);
+ c->eof = 0;
unlock(&c->r.lk);
unlock(&p->l);