]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/DS.pm
DS: get rid of unused methods and aliases
[public-inbox.git] / lib / PublicInbox / DS.pm
index ea09fc96ed6cc9f38af0d629c2d358d0b3ef8ec1..0acb034fc25cc5718539a6f858cc7dfdc3b6a02a 100644 (file)
@@ -105,17 +105,6 @@ sub HaveEpoll {
     return $HaveEpoll;
 }
 
-=head2 C<< CLASS->WatchedSockets() >>
-
-Returns the number of file descriptors which are registered with the global
-poll object.
-
-=cut
-sub WatchedSockets {
-    return scalar keys %DescriptorMap;
-}
-*watched_sockets = *WatchedSockets;
-
 =head2 C<< CLASS->ToClose() >>
 
 Return the list of sockets that are awaiting close() at the end of the
@@ -206,20 +195,6 @@ sub AddTimer {
     die "Shouldn't get here.";
 }
 
-=head2 C<< CLASS->DescriptorMap() >>
-
-Get the hash of PublicInbox::DS objects keyed by the file descriptor (fileno) they
-are wrapping.
-
-Returns a hash in list context or a hashref in scalar context.
-
-=cut
-sub DescriptorMap {
-    return wantarray ? %DescriptorMap : \%DescriptorMap;
-}
-*descriptor_map = *DescriptorMap;
-*get_sock_ref = *DescriptorMap;
-
 sub _InitPoller
 {
     return if $DoneInit;
@@ -333,8 +308,8 @@ sub EpollEventLoop {
                 } else {
                     my $fd = $ev->[0];
                     warn "epoll() returned fd $fd w/ state $state for which we have no mapping.  removing.\n";
-                    POSIX::close($fd);
                     epoll_ctl($Epoll, EPOLL_CTL_DEL, $fd, 0);
+                    POSIX::close($fd);
                 }
                 next;
             }
@@ -386,7 +361,7 @@ sub PollEventLoop {
         }
 
         my $count = IO::Poll::_poll($timeout, @poll);
-        unless ($count) {
+        unless ($count >= 0) {
             return unless PostEventLoop();
             next;
         }
@@ -1033,13 +1008,6 @@ sub as_string {
     return $ret;
 }
 
-sub _undef {
-    return undef unless $ENV{DS_DEBUG};
-    my $msg = shift || "";
-    warn "PublicInbox::DS: $msg\n";
-    return undef;
-}
-
 package PublicInbox::DS::Timer;
 # [$abs_float_firetime, $coderef];
 sub cancel {