App-TLSMe

 view release on metacpan or  search on metacpan

lib/App/TLSMe/Connection.pm  view on Meta::CPAN


sub _on_send_handler {
    my $self = shift;

    return sub {
        my $handle = shift;

        $self->{backend_handle}->push_write($handle->rbuf);
        $handle->{rbuf} = '';
      }
}

sub _on_read_handler {
    my $self = shift;

    return sub {
        my ($backend_handle) = @_ or return;

        $self->{handle}->push_write($backend_handle->rbuf);
        $backend_handle->{rbuf} = '';
      }
}

sub _close_handle {
    my $self = shift;
    my ($handle) = @_;

    $handle->wtimeout(0);

    $handle->on_drain;
    $handle->on_error;

    $handle->on_drain(
        sub {
            $_[0]->destroy;
            undef $handle;
        }
    );

    undef $handle;
}

1;
__END__

=head1 NAME

App::TLSMe::Connection - Connection class

=head1 SYNOPSIS

    App::TLSMe::Connection->new(
        fh => $fh,
        backend_host => 'localhost',
        backend_port => 8080,
        ...
    );

=head1 DESCRIPTION

Object-Value that holds handles, callbacks and other information associated with
proxy-backend connection.

=head1 METHODS

=head2 C<new>

    my $connection = App::TLSMe::Connection->new;

=head2 C<write>

    $connection->write(...);

=cut



( run in 1.931 second using v1.01-cache-2.11-cpan-140bd7fdf52 )