diff options
| author | rsc <devnull@localhost> | 2004-06-09 14:10:32 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-06-09 14:10:32 +0000 |
| commit | 8baa0cbdff53a5a98f27565c9334ea56ee4a4b76 (patch) | |
| tree | d53214c1f9bc3e1eab8a690c45b53d5a0394f617 /src/libventi/send.c | |
| parent | 3040f28913ad0465506cfb6a7153a480efff7871 (diff) | |
| download | plan9port-8baa0cbdff53a5a98f27565c9334ea56ee4a4b76.tar.gz plan9port-8baa0cbdff53a5a98f27565c9334ea56ee4a4b76.zip | |
various debugging
Diffstat (limited to 'src/libventi/send.c')
| -rw-r--r-- | src/libventi/send.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libventi/send.c b/src/libventi/send.c index fd6fa57a..726c4027 100644 --- a/src/libventi/send.c +++ b/src/libventi/send.c @@ -1,15 +1,20 @@ #include <u.h> +#include <errno.h> #include <libc.h> #include <venti.h> #include "queue.h" +long ventisendbytes, ventisendpackets; +long ventirecvbytes, ventirecvpackets; + static int _vtsend(VtConn *z, Packet *p) { IOchunk ioc; int n; uchar buf[2]; - + + if(z->state != VtStateConnected) { werrstr("session not connected"); return -1; @@ -25,6 +30,8 @@ _vtsend(VtConn *z, Packet *p) buf[0] = n>>8; buf[1] = n; packetprefix(p, buf, 2); + ventisendbytes += n+2; + ventisendpackets++; for(;;){ n = packetfragments(p, &ioc, 1, 0); @@ -62,7 +69,7 @@ _vtrecv(VtConn *z) if(0) fprint(2, "%d read hdr\n", getpid()); n = read(z->infd, b, MaxFragSize); if(0) fprint(2, "%d got %d (%r)\n", getpid(), n); - if(n <= 0) + if(n==0 || (n<0 && errno!=EINTR)) goto Err; size += n; packettrim(p, 0, size); @@ -84,9 +91,11 @@ _vtrecv(VtConn *z) if(n > 0) size += n; packettrim(p, 0, size); - if(n <= 0) + if(n==0 || (n<0 && errno!=EINTR)) goto Err; } + ventirecvbytes += len; + ventirecvpackets++; p = packetsplit(p, len); return p; Err: |
