ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Handle.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Handle.pm (file contents):
Revision 1.156 by root, Wed Jul 22 05:37:32 2009 UTC vs.
Revision 1.157 by root, Wed Jul 22 23:07:13 2009 UTC

1519 1519
1520Instead of starting TLS negotiation immediately when the AnyEvent::Handle 1520Instead of starting TLS negotiation immediately when the AnyEvent::Handle
1521object is created, you can also do that at a later time by calling 1521object is created, you can also do that at a later time by calling
1522C<starttls>. 1522C<starttls>.
1523 1523
1524Starting TLS is currently an asynchronous operation - when you push some
1525write data and then call C<< ->starttls >> then TLS negotiation will start
1526immediately, after which the queued write data is then sent.
1527
1524The first argument is the same as the C<tls> constructor argument (either 1528The first argument is the same as the C<tls> constructor argument (either
1525C<"connect">, C<"accept"> or an existing Net::SSLeay object). 1529C<"connect">, C<"accept"> or an existing Net::SSLeay object).
1526 1530
1527The second argument is the optional C<AnyEvent::TLS> object that is used 1531The second argument is the optional C<AnyEvent::TLS> object that is used
1528when AnyEvent::Handle has to create its own TLS connection object, or 1532when AnyEvent::Handle has to create its own TLS connection object, or
1552 $ERROR_SYSCALL = Net::SSLeay::ERROR_SYSCALL (); 1556 $ERROR_SYSCALL = Net::SSLeay::ERROR_SYSCALL ();
1553 $ERROR_WANT_READ = Net::SSLeay::ERROR_WANT_READ (); 1557 $ERROR_WANT_READ = Net::SSLeay::ERROR_WANT_READ ();
1554 1558
1555 $ctx ||= $self->{tls_ctx}; 1559 $ctx ||= $self->{tls_ctx};
1556 1560
1561 local $Carp::CarpLevel = 1; # skip ourselves when creating a new context or session
1562
1557 if ("HASH" eq ref $ctx) { 1563 if ("HASH" eq ref $ctx) {
1558 require AnyEvent::TLS; 1564 require AnyEvent::TLS;
1559
1560 local $Carp::CarpLevel = 1; # skip ourselves when creating a new context
1561 1565
1562 if ($ctx->{cache}) { 1566 if ($ctx->{cache}) {
1563 my $key = $ctx+0; 1567 my $key = $ctx+0;
1564 $ctx = $TLS_CACHE{$key} ||= new AnyEvent::TLS %$ctx; 1568 $ctx = $TLS_CACHE{$key} ||= new AnyEvent::TLS %$ctx;
1565 } else { 1569 } else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines