ECONNRESET and EPIPE are common on a big Internet filled with
unreliable connections, and there's nothing our code can do
about it.
So no point in wasting code to log them and there are plenty of
tracing tools to choose from if such diagnostics are needed.
'event_watch', # bitmask of events the client is interested in (POLLIN,OUT,etc.)
);
'event_watch', # bitmask of events the client is interested in (POLLIN,OUT,etc.)
);
-use Errno qw(EPIPE EAGAIN ECONNRESET EINVAL);
+use Errno qw(EAGAIN EINVAL);
use Carp qw(croak confess);
use constant DebugLevel => 0;
use Carp qw(croak confess);
use constant DebugLevel => 0;
-=head2 C<< $obj->close( [$reason] ) >>
+=head2 C<< $obj->close >>
-Close the socket. The I<reason> argument will be used in debugging messages.
=cut
sub close {
my PublicInbox::DS $self = $_[0];
return if $self->{closed};
=cut
sub close {
my PublicInbox::DS $self = $_[0];
return if $self->{closed};
- # print out debugging info for this close
- if (DebugLevel) {
- my ($pkg, $filename, $line) = caller;
- my $reason = $_[1] || "";
- warn "Closing \#$self->{fd} due to $pkg/$filename/$line ($reason)\n";
- }
-
# this does most of the work of closing us
$self->_cleanup();
# this does most of the work of closing us
$self->_cleanup();
$self->{wbuf_off});
if (! defined $written) {
$self->{wbuf_off});
if (! defined $written) {
- if ($! == EPIPE) {
- return $self->close("EPIPE");
- } elsif ($! == EAGAIN) {
# since connection has stuff to write, it should now be
# interested in pending writes:
if ($need_queue) {
# since connection has stuff to write, it should now be
# interested in pending writes:
if ($need_queue) {
}
$self->watch_write(1);
return 0;
}
$self->watch_write(1);
return 0;
- } elsif ($! == ECONNRESET) {
- return $self->close("ECONNRESET");
- DebugLevel >= 1 && $self->debugmsg("Closing connection ($self) due to write error: $!\n");
-
- return $self->close("write_error");
} elsif ($written != $to_write) {
DebugLevel >= 2 && $self->debugmsg("Wrote PARTIAL %d bytes to %d",
$written, $self->{fd});
} elsif ($written != $to_write) {
DebugLevel >= 2 && $self->debugmsg("Wrote PARTIAL %d bytes to %d",
$written, $self->{fd});