From: ian Date: Sat, 16 Oct 1999 19:43:26 +0000 (+0000) Subject: Sensible handling of empty reads. X-Git-Tag: privaterel-1999-10-16-fanf X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=commitdiff_plain;h=680003740eaac3b9fb876dc1ac4d321942b451f0 Sensible handling of empty reads. --- diff --git a/changelog b/changelog index c86a8d9..0ef286c 100644 --- a/changelog +++ b/changelog @@ -8,6 +8,7 @@ adns (0.6) unstable; urgency=high * adnshost prints somewhat better messages about some wrong usages. * Include stdlib.h in adnshost.h. * adnslogres: parsing and error checking improved (Tony Finch). + * Regresion tests can cope with zero-length reads. General improvements * New adns_if_logpid option (functionality suggested by Tony Finch). diff --git a/regress/case-1stservbroken.sys b/regress/case-1stservbroken.sys index 97d861e..36c7837 100644 --- a/regress/case-1stservbroken.sys +++ b/regress/case-1stservbroken.sys @@ -1,40 +1,37 @@ 1stservbroken :12 trunc.test.iwj.relativity.greenend.org.uk - start 940100522.187436 + start 940102940.701451 socket type=SOCK_DGRAM socket=4 - +0.000592 + +0.000612 fcntl fd=4 cmd=F_GETFL fcntl=~O_NONBLOCK&... - +0.000614 + +0.000605 fcntl fd=4 cmd=F_SETFL O_NONBLOCK|... fcntl=OK - +0.000566 + +0.000573 sendto fd=4 addr=172.18.45.2:53 311f0100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61 74697669 74790867 7265656e 656e6403 6f726702 756b0000 0c0001. sendto=59 - +0.006062 - select max=5 rfds=[4] wfds=[] efds=[] to=1.993938 + +0.006374 + select max=5 rfds=[4] wfds=[] efds=[] to=1.993626 select=1 rfds=[4] wfds=[] efds=[] - +0.001590 + +0.001402 recvfrom fd=4 buflen=512 *addrlen=16 recvfrom=ECONNREFUSED - +0.000661 - select max=5 rfds=[4] wfds=[] efds=[] to=1.991687 + +0.000666 + select max=5 rfds=[4] wfds=[] efds=[] to=1.991558 select=0 rfds=[] wfds=[] efds=[] - +2.-08754 - select max=5 rfds=[4] wfds=[] efds=[] to=0.000441 - select=0 rfds=[] wfds=[] efds=[] - +0.009803 + +2.-02914 sendto fd=4 addr=172.18.45.6:53 311f0100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61 74697669 74790867 7265656e 656e6403 6f726702 756b0000 0c0001. sendto=59 - +0.002097 - select max=5 rfds=[4] wfds=[] efds=[] to=1.997903 + +0.002262 + select max=5 rfds=[4] wfds=[] efds=[] to=1.997738 select=1 rfds=[4] wfds=[] efds=[] - +0.000971 + +0.000973 recvfrom fd=4 buflen=512 *addrlen=16 recvfrom=OK addr=172.18.45.6:53 311f8380 00010008 00000000 05747275 6e630474 65737403 69776a0a 72656c61 @@ -52,72 +49,73 @@ 000c0001 0000003c 0024046c 6f6e6706 646f6d61 696e0274 6f05666f 7263650a 7472756e 63617469 6f6e0136 c069c00c 000c0001 0000003c 0024046c 6f6e6706 646f6d61 696e0274 6f05666f 7263650a 7472756e 63617469 6f6e0137 c069. - +0.004198 + +0.004340 socket type=SOCK_STREAM socket=5 - +0.004875 + +0.005126 fcntl fd=5 cmd=F_GETFL fcntl=~O_NONBLOCK&... - +0.000570 + +0.000742 fcntl fd=5 cmd=F_SETFL O_NONBLOCK|... fcntl=OK - +0.000554 + +0.000604 connect fd=5 addr=172.18.45.2:53 connect=EINPROGRESS - +0.000793 + +0.000797 recvfrom fd=4 buflen=512 *addrlen=16 recvfrom=EAGAIN - +0.000784 - select max=6 rfds=[4] wfds=[5] efds=[] to=13.988226 + +0.000829 + select max=6 rfds=[4] wfds=[5] efds=[] to=13.987562 select=1 rfds=[] wfds=[5] efds=[] - +0.001148 + +0.001172 read fd=5 buflen=1 - read=OK empty - +0.001123 + read=OK + . + +0.001161 write fd=5 003b311f 01000001 00000000 00000574 72756e63 04746573 74036977 6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00000c00 01. write=61 - +0.003548 - select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.982407 + +0.003598 + select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.981631 select=1 rfds=[5] wfds=[] efds=[] - +0.001355 + +0.001370 read fd=5 buflen=2 read=EPIPE - +0.001444 + +0.001699 close fd=5 close=OK - +0.000660 + +0.000687 socket type=SOCK_STREAM socket=5 - +0.004654 + +0.004866 fcntl fd=5 cmd=F_GETFL fcntl=~O_NONBLOCK&... - +0.000570 + +0.000611 fcntl fd=5 cmd=F_SETFL O_NONBLOCK|... fcntl=OK - +0.000602 + +0.000574 connect fd=5 addr=172.18.45.6:53 connect=EINPROGRESS - +0.001046 + +0.001082 select max=6 rfds=[4] wfds=[5] efds=[] to=14.000000 select=1 rfds=[] wfds=[5] efds=[] - +0.000999 + +0.001011 read fd=5 buflen=1 read=EAGAIN - +0.000579 + +0.000595 write fd=5 003b311f 01000001 00000000 00000574 72756e63 04746573 74036977 6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00000c00 01. write=61 - +0.004802 - select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.965696 + +0.005087 + select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.964049 select=1 rfds=[5] wfds=[] efds=[] - +0.001239 + +0.001295 read fd=5 buflen=2 read=OK 0638. - +0.000653 + +0.000649 read fd=5 buflen=1592 read=OK 311f8580 0001001e 00010001 05747275 6e630474 65737403 69776a0a 72656c61 @@ -170,13 +168,13 @@ 69c00c00 0c000100 00003c00 25046c6f 6e670664 6f6d6169 6e02746f 05666f72 63650a74 72756e63 6174696f 6e023239 c069c069 00020001 0000003c 0006036e 7330c072 036e7330 c0720001 00010001 51800004 ac122d06. - +0.008947 + +0.009426 read fd=5 buflen=1594 read=EAGAIN - +0.032609 + +0.033394 close fd=4 close=OK - +0.051246 + +0.054384 close fd=5 close=OK - +0.001019 + +0.000977 diff --git a/regress/hcommon.c.m4 b/regress/hcommon.c.m4 index 26798cb..59d97ed 100644 --- a/regress/hcommon.c.m4 +++ b/regress/hcommon.c.m4 @@ -131,7 +131,7 @@ void Tvbbytes(const void *buf, int len) { const byte *bp; int i; - if (!len) { Tvba(" empty"); return; } + if (!len) { Tvba("\n ."); return; } for (i=0, bp=buf; i