"fileno(undef)" already dies under "use strict", so there's no
need to check for it ourselves. As far as "fileno($closed_io)"
or "fileno($fake_io)" goes, we'll let epoll_ctl detect the
error, instead.
Our design should make DescriptorMap entries impossible to clobber,
so make it fatal via confess in case it does happen, because
inadvertantly clobbering a FD would be very bad. While we're at
it, remove a redundant return statement and rely on implicit
returns.
$self->{sock} = $sock;
my $fd = fileno($sock);
$self->{sock} = $sock;
my $fd = fileno($sock);
- Carp::cluck("undef sock and/or fd in PublicInbox::DS->new. sock=" . ($sock || "") . ", fd=" . ($fd || ""))
- unless $sock && $fd;
-
_InitPoller();
if (epoll_ctl($Epoll, EPOLL_CTL_ADD, $fd, $ev)) {
_InitPoller();
if (epoll_ctl($Epoll, EPOLL_CTL_ADD, $fd, $ev)) {
}
die "couldn't add epoll watch for $fd: $!\n";
}
}
die "couldn't add epoll watch for $fd: $!\n";
}
- Carp::cluck("PublicInbox::DS::new blowing away existing descriptor map for fd=$fd ($DescriptorMap{$fd})")
- if $DescriptorMap{$fd};
+ confess("DescriptorMap{$fd} defined ($DescriptorMap{$fd})")
+ if defined($DescriptorMap{$fd});
$DescriptorMap{$fd} = $self;
$DescriptorMap{$fd} = $self;