about summary refs log tree commit homepage
path: root/t
diff options
authorEric Wong <e@80x24.org>2016-04-30 02:57:40 +0000
committerEric Wong <e@80x24.org>2016-04-30 08:29:33 +0000
commit9da6fcbb3e6d720a4b575a48063ecf3240a44022 (patch)
tree2f633838fd3e5595c2cbb57dfd421713f2a5533c /t
parentf30a78b3b8f00298c5be2aa724a7358ff892efda (diff)
git clones may take longer than 30s, much longer...  So prepare
to wait almost indefinitely for sockets to timeout and document
the second signal behavior for immediate shutdown.

While we're at it, move parent death handling to a separate
class to avoid Danga::Socket->AddOtherFds, since that does not
allow proper handling the parent pipe being closed and would
actually misterminate a worker prematurely.  t/nntpd.t is update
to illustrate the failure with workers enabled.

We will work to keep memory usage low and let clients take their
time without interrupting them.
Diffstat (limited to 't')
1 files changed, 8 insertions, 4 deletions
diff --git a/t/nntpd.t b/t/nntpd.t
index d597855b..d0332216 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -185,7 +185,12 @@ EOF
                  'XHDR on invalid header returns empty');
-                syswrite($s, "HDR List-id 1-\r\n");
+                setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1);
+                syswrite($s, 'HDR List-id 1-');
+                select(undef, undef, undef, 0.15);
+                ok(kill('TERM', $pid), 'killed nntpd');
+                select(undef, undef, undef, 0.15);
+                syswrite($s, "\r\n");
                 $buf = '';
                 do {
                         sysread($s, $buf, 4096, length($buf));
@@ -196,9 +201,8 @@ EOF
                 is(scalar @r, 1, 'only one response line');
-        ok(kill('TERM', $pid), 'killed nntpd');
-        $pid = undef;
-        waitpid(-1, 0);
+        is($pid, waitpid($pid, 0), 'nntpd exited successfully');
+        is($?, 0, 'no error in exited process');