1#  You may distribute under the terms of either the GNU General Public License
2#  or the Artistic License (the same terms as Perl itself)
3#
4#  (C) Paul Evans, 2010-2015 -- leonerd@leonerd.org.uk
5
6package IO::Async::SSLStream;
7
8use strict;
9use warnings;
10use base qw( IO::Async::Stream );
11IO::Async::Stream->VERSION( '0.59' );
12
13our $VERSION = '0.22';
14$VERSION = eval $VERSION;
15
16use IO::Async::SSL;
17
18=head1 NAME
19
20C<IO::Async::SSLStream> - read and write buffers around an SSL connection
21
22=head1 DESCRIPTION
23
24This subclass of L<IO::Async::Stream> provides support for using an SSL
25connection, as created by L<IO::Async::SSL>'s C<SSL_connect> or C<SSL_listen>
26extension methods. After one of these methods has provided a socket handle, it
27should be wrapped in an L<IO::Async::SSLStream> object to provide the usual
28C<on_read> callback.
29
30It provides no extra methods and consumes no extra configuration parameters;
31treat it the same as a regular C<IO::Async::Stream> object.
32
33See the main L<IO::Async::SSL> documentation for an example of its use.
34
35=cut
36
37sub _init
38{
39   my $self = shift;
40   my ( $params ) = @_;
41
42   $params->{reader} = \&IO::Async::SSL::sslread;
43   $params->{writer} = \&IO::Async::SSL::sslwrite;
44
45   $self->SUPER::_init( $params );
46}
47
48=head1 BUGS
49
50=over 4
51
52=item *
53
54Currently, this subclass does not completely handle the C<autoflush> configure
55option. It is possible for the C<SSL_write(3ssl)> call to fail with C<EAGAIN>
56and C<SSL_WANT_READ>, indicating that it wishes to read (perhaps to obtain
57fresh keys from the server). In this case, the subclass will not correctly
58poll for readability and retry the write operation. This bug does not occur
59with regular C<write> with C<autoflush> turned off.
60
61=back
62
63=head1 AUTHOR
64
65Paul Evans <leonerd@leonerd.org.uk>
66
67=cut
68
690x55AA;
70