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.61 by root, Fri Jun 6 10:23:50 2008 UTC vs.
Revision 1.62 by root, Fri Jun 6 10:49:20 2008 UTC

166=item low_water_mark => <bytes> 166=item low_water_mark => <bytes>
167 167
168Sets the amount of bytes (default: C<0>) that make up an "empty" write 168Sets the amount of bytes (default: C<0>) that make up an "empty" write
169buffer: If the write reaches this size or gets even samller it is 169buffer: If the write reaches this size or gets even samller it is
170considered empty. 170considered empty.
171
172=item linger => <seconds>
173
174If non-zero (default: C<3600>), then the destructor of the
175AnyEvent::Handle object will check wether there is still outstanding write
176data and will install a watcher that will write out this data. No errors
177will be reported (this mostly matches how the operating system treats
178outstanding data at socket close time).
179
180This will not work for partial TLS data that could not yet been
181encoded. This data will be lost.
171 182
172=item tls => "accept" | "connect" | Net::SSLeay::SSL object 183=item tls => "accept" | "connect" | Net::SSLeay::SSL object
173 184
174When this parameter is given, it enables TLS (SSL) mode, that means it 185When this parameter is given, it enables TLS (SSL) mode, that means it
175will start making tls handshake and will transparently encrypt/decrypt 186will start making tls handshake and will transparently encrypt/decrypt
1253 1264
1254sub DESTROY { 1265sub DESTROY {
1255 my $self = shift; 1266 my $self = shift;
1256 1267
1257 $self->stoptls; 1268 $self->stoptls;
1269
1270 my $linger = exists $self->{linger} ? $self->{linger} : 3600;
1271
1272 if ($linger && length $self->{wbuf}) {
1273 my $fh = delete $self->{fh};
1274 my $wbuf = delete $self->{wbuf};
1275
1276 my @linger;
1277
1278 push @linger, AnyEvent->io (fh => $fh, poll => "w", cb => sub {
1279 my $len = syswrite $fh, $wbuf, length $wbuf;
1280
1281 if ($len > 0) {
1282 substr $wbuf, 0, $len, "";
1283 } else {
1284 @linger = (); # end
1285 }
1286 });
1287 push @linger, AnyEvent->timer (after => $linger, cb => sub {
1288 @linger = ();
1289 });
1290 }
1258} 1291}
1259 1292
1260=item AnyEvent::Handle::TLS_CTX 1293=item AnyEvent::Handle::TLS_CTX
1261 1294
1262This function creates and returns the Net::SSLeay::CTX object used by 1295This function creates and returns the Net::SSLeay::CTX object used by

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines