bug fixes
This commit is contained in:
parent
aa1d0b1bb0
commit
361e279c59
5 changed files with 16 additions and 11 deletions
|
|
@ -135,9 +135,12 @@ int
|
|||
vtwrite(VtConn *z, uchar score[VtScoreSize], uint type, uchar *buf, int n)
|
||||
{
|
||||
Packet *p;
|
||||
int nn;
|
||||
|
||||
p = packetforeign(buf, n, 0, nil);
|
||||
return vtwritepacket(z, score, type, p);
|
||||
nn = vtwritepacket(z, score, type, p);
|
||||
packetfree(p);
|
||||
return nn;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -33,8 +33,11 @@ vtparsescore(char *s, char **prefix, uchar score[VtScoreSize])
|
|||
}
|
||||
if(colon){
|
||||
*colon = 0;
|
||||
*prefix = s;
|
||||
}else
|
||||
*prefix = nil;
|
||||
if(prefix)
|
||||
*prefix = s;
|
||||
}else{
|
||||
if(prefix)
|
||||
*prefix = nil;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ _vtrecv(VtConn *z)
|
|||
/* get enough for head size */
|
||||
size = packetsize(p);
|
||||
while(size < 2) {
|
||||
b = packettrailer(p, MaxFragSize);
|
||||
b = packettrailer(p, 2);
|
||||
assert(b != nil);
|
||||
if(0) fprint(2, "%d read hdr\n", getpid());
|
||||
n = read(z->infd, b, MaxFragSize);
|
||||
n = read(z->infd, b, 2);
|
||||
if(0) fprint(2, "%d got %d (%r)\n", getpid(), n);
|
||||
if(n==0 || (n<0 && !interrupted()))
|
||||
goto Err;
|
||||
|
|
@ -90,8 +90,8 @@ _vtrecv(VtConn *z)
|
|||
size -= 2;
|
||||
|
||||
while(size < len) {
|
||||
// n = len - size;
|
||||
// if(n > MaxFragSize)
|
||||
n = len - size;
|
||||
if(n > MaxFragSize)
|
||||
n = MaxFragSize;
|
||||
b = packettrailer(p, n);
|
||||
if(0) fprint(2, "%d read body %d\n", getpid(), n);
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ vtsrvhello(VtConn *z)
|
|||
VtFcall tx, rx;
|
||||
Packet *p;
|
||||
|
||||
if((p = vtrecv(z)) == nil){
|
||||
werrstr("unexpected eof on venti connection");
|
||||
if((p = vtrecv(z)) == nil)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(vtfcallunpack(&tx, p) < 0){
|
||||
packetfree(p);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ Okay:
|
|||
return 0;
|
||||
|
||||
Err:
|
||||
werrstr("vtversion: %r");
|
||||
if(z->infd >= 0)
|
||||
close(z->infd);
|
||||
if(z->outfd >= 0 && z->outfd != z->infd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue