… | |
… | |
295 | |
295 | |
296 | $self->{fh} or Carp::croak "mandatory argument fh is missing"; |
296 | $self->{fh} or Carp::croak "mandatory argument fh is missing"; |
297 | |
297 | |
298 | AnyEvent::Util::fh_nonblocking $self->{fh}, 1; |
298 | AnyEvent::Util::fh_nonblocking $self->{fh}, 1; |
299 | |
299 | |
300 | if ($self->{tls}) { |
|
|
301 | require Net::SSLeay; |
|
|
302 | $self->starttls (delete $self->{tls}, delete $self->{tls_ctx}); |
300 | $self->starttls (delete $self->{tls}, delete $self->{tls_ctx}) |
303 | } |
301 | if $self->{tls}; |
304 | |
302 | |
305 | $self->{_activity} = AnyEvent->now; |
303 | $self->{_activity} = AnyEvent->now; |
306 | $self->_timeout; |
304 | $self->_timeout; |
307 | |
305 | |
308 | $self->on_drain (delete $self->{on_drain}) if exists $self->{on_drain}; |
306 | $self->on_drain (delete $self->{on_drain}) if exists $self->{on_drain}; |
… | |
… | |
1374 | |
1372 | |
1375 | =cut |
1373 | =cut |
1376 | |
1374 | |
1377 | sub starttls { |
1375 | sub starttls { |
1378 | my ($self, $ssl, $ctx) = @_; |
1376 | my ($self, $ssl, $ctx) = @_; |
|
|
1377 | |
|
|
1378 | require Net::SSLeay; |
1379 | |
1379 | |
1380 | Carp::croak "it is an error to call starttls more than once on an Anyevent::Handle object" |
1380 | Carp::croak "it is an error to call starttls more than once on an Anyevent::Handle object" |
1381 | if $self->{tls}; |
1381 | if $self->{tls}; |
1382 | |
1382 | |
1383 | if ($ssl eq "accept") { |
1383 | if ($ssl eq "accept") { |
… | |
… | |
1426 | |
1426 | |
1427 | sub stoptls { |
1427 | sub stoptls { |
1428 | my ($self) = @_; |
1428 | my ($self) = @_; |
1429 | |
1429 | |
1430 | if ($self->{tls}) { |
1430 | if ($self->{tls}) { |
1431 | Net::SSLeay::shutdown $self->{tls}; |
1431 | Net::SSLeay::shutdown ($self->{tls}); |
1432 | |
1432 | |
1433 | &_dotls; |
1433 | &_dotls; |
1434 | |
1434 | |
1435 | # we don't give a shit. no, we do, but we can't. no... |
1435 | # we don't give a shit. no, we do, but we can't. no... |
1436 | # we, we... have to use openssl :/ |
1436 | # we, we... have to use openssl :/ |