]> Sergey Matveev's repositories - public-inbox.git/commitdiff
nntpd: better encapsulation for shutdown
authorEric Wong <e@80x24.org>
Thu, 24 Sep 2015 03:37:20 +0000 (03:37 +0000)
committerEric Wong <e@80x24.org>
Thu, 24 Sep 2015 06:58:33 +0000 (06:58 +0000)
We can use the UNIVERSAL::can to better encapsulate the shutdown
process, in case we need to implement a gopher or HTTP daemon.

public-inbox-nntpd

index 70bab46f304bc121ef1bf62b570665f79c0a669d..9fb69cec67ef7bc8544aea3c195503d1e4cd0453 100644 (file)
@@ -204,8 +204,7 @@ sub worker_quit {
                my $n = 0;
 
                foreach my $s (values %$dmap) {
-                       next unless ref($s) eq 'PublicInbox::NNTP';
-                       if ($s->busy) {
+                       if ($s->can('busy') && $s->busy) {
                                ++$n;
                        } else {
                                $s->close;