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.97 by root, Thu Oct 2 11:07:59 2008 UTC vs.
Revision 1.99 by root, Thu Oct 23 02:41:00 2008 UTC

58means characters. As sysread and syswrite are used for all I/O, their 58means characters. As sysread and syswrite are used for all I/O, their
59treatment of characters applies to this module as well. 59treatment of characters applies to this module as well.
60 60
61All callbacks will be invoked with the handle object as their first 61All callbacks will be invoked with the handle object as their first
62argument. 62argument.
63
64=head2 SIGPIPE is not handled by this module
65
66SIGPIPE is not handled by this module, so one of the practical
67requirements of using it is to ignore SIGPIPE (C<$SIG{PIPE} =
68'IGNORE'>). At least, this is highly recommend in a networked program: If
69you use AnyEvent::Handle in a filter program (like sort), exiting on
70SIGPIPE is probably the right thing to do.
71 63
72=head1 METHODS 64=head1 METHODS
73 65
74=over 4 66=over 4
75 67
1478 @linger = (); 1470 @linger = ();
1479 }); 1471 });
1480 } 1472 }
1481} 1473}
1482 1474
1475=item $handle->destroy
1476
1477Shut's down the handle object as much as possible - this call ensures that
1478no further callbacks will be invoked and resources will be freed as much
1479as possible. You must not call any methods on the object afterwards.
1480
1481The handle might still linger in the background and write out remaining
1482data, as specified by the C<linger> option, however.
1483
1484=cut
1485
1486sub destroy {
1487 my ($self) = @_;
1488
1489 $self->DESTROY;
1490 %$self = ();
1491}
1492
1483=item AnyEvent::Handle::TLS_CTX 1493=item AnyEvent::Handle::TLS_CTX
1484 1494
1485This function creates and returns the Net::SSLeay::CTX object used by 1495This function creates and returns the Net::SSLeay::CTX object used by
1486default for TLS mode. 1496default for TLS mode.
1487 1497
1558 $handle->on_drain (sub { 1568 $handle->on_drain (sub {
1559 warn "all data submitted to the kernel\n"; 1569 warn "all data submitted to the kernel\n";
1560 undef $handle; 1570 undef $handle;
1561 }); 1571 });
1562 1572
1573=item I get different callback invocations in TLS mode/Why can't I pause
1574reading?
1575
1576Unlike, say, TCP, TLS conenctions do not consist of two independent
1577communication channels, one for each direction. Or put differently. the
1578read and write directions are not independent of each other: you cannot
1579write data unless you are also prepared to read, and vice versa.
1580
1581This can mean than, in TLS mode, you might get C<on_error> or C<on_eof>
1582callback invocations when you are not expecting any read data - the reason
1583is that AnyEvent::Handle always reads in TLS mode.
1584
1585During the connection, you have to make sure that you always have a
1586non-empty read-queue, or an C<on_read> watcher. At the end of the
1587connection (or when you no longer want to use it) you can call the
1588C<destroy> method.
1589
1563=back 1590=back
1564 1591
1565 1592
1566=head1 SUBCLASSING AnyEvent::Handle 1593=head1 SUBCLASSING AnyEvent::Handle
1567 1594

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines