… | |
… | |
1470 | @linger = (); |
1470 | @linger = (); |
1471 | }); |
1471 | }); |
1472 | } |
1472 | } |
1473 | } |
1473 | } |
1474 | |
1474 | |
|
|
1475 | =item $handle->destroy |
|
|
1476 | |
|
|
1477 | Shut's down the handle object as much as possible - this call ensures that |
|
|
1478 | no further callbacks will be invoked and resources will be freed as much |
|
|
1479 | as possible. You must not call any methods on the object afterwards. |
|
|
1480 | |
|
|
1481 | The handle might still linger in the background and write out remaining |
|
|
1482 | data, as specified by the C<linger> option, however. |
|
|
1483 | |
|
|
1484 | =cut |
|
|
1485 | |
|
|
1486 | sub destroy { |
|
|
1487 | my ($self) = @_; |
|
|
1488 | |
|
|
1489 | $self->DESTROY; |
|
|
1490 | %$self = (); |
|
|
1491 | } |
|
|
1492 | |
1475 | =item AnyEvent::Handle::TLS_CTX |
1493 | =item AnyEvent::Handle::TLS_CTX |
1476 | |
1494 | |
1477 | This function creates and returns the Net::SSLeay::CTX object used by |
1495 | This function creates and returns the Net::SSLeay::CTX object used by |
1478 | default for TLS mode. |
1496 | default for TLS mode. |
1479 | |
1497 | |
… | |
… | |
1550 | $handle->on_drain (sub { |
1568 | $handle->on_drain (sub { |
1551 | warn "all data submitted to the kernel\n"; |
1569 | warn "all data submitted to the kernel\n"; |
1552 | undef $handle; |
1570 | undef $handle; |
1553 | }); |
1571 | }); |
1554 | |
1572 | |
|
|
1573 | =item I get different callback invocations in TLS mode/Why can't I pause |
|
|
1574 | reading? |
|
|
1575 | |
|
|
1576 | Unlike, say, TCP, TLS conenctions do not consist of two independent |
|
|
1577 | communication channels, one for each direction. Or put differently. the |
|
|
1578 | read and write directions are not independent of each other: you cannot |
|
|
1579 | write data unless you are also prepared to read, and vice versa. |
|
|
1580 | |
|
|
1581 | This can mean than, in TLS mode, you might get C<on_error> or C<on_eof> |
|
|
1582 | callback invocations when you are not expecting any read data - the reason |
|
|
1583 | is that AnyEvent::Handle always reads in TLS mode. |
|
|
1584 | |
|
|
1585 | During the connection, you have to make sure that you always have a |
|
|
1586 | non-empty read-queue, or an C<on_read> watcher. At the end of the |
|
|
1587 | connection (or when you no longer want to use it) you can call the |
|
|
1588 | C<destroy> method. |
|
|
1589 | |
1555 | =back |
1590 | =back |
1556 | |
1591 | |
1557 | |
1592 | |
1558 | =head1 SUBCLASSING AnyEvent::Handle |
1593 | =head1 SUBCLASSING AnyEvent::Handle |
1559 | |
1594 | |