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