- while (1) {
- my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
- if (scalar(@fds) == 1 && !defined($fds[0])) {
- return if $!{EAGAIN};
- next if $!{EINTR};
- die "recvmsg: $!";
- }
- # open so perl can auto-close them:
- for my $fd (@fds) {
- open(my $newfh, '+<&=', $fd) or die "open +<&=$fd: $!";
- }
- return $self->close if $buf eq '';
- warn Dumper({ 'unexpected self msg' => $buf, fds => \@fds });
- # TODO: figure out what to do with these messages...
+ my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
+ if (scalar(@fds) == 1 && !defined($fds[0])) {
+ return if $!{EAGAIN};
+ die "recvmsg: $!" unless $!{ECONNRESET};
+ $buf = '';
+ } else { # just in case open so perl can auto-close them:
+ for (@fds) { open my $fh, '+<&=', $_ };