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