… | |
… | |
166 | =item low_water_mark => <bytes> |
166 | =item low_water_mark => <bytes> |
167 | |
167 | |
168 | Sets the amount of bytes (default: C<0>) that make up an "empty" write |
168 | Sets the amount of bytes (default: C<0>) that make up an "empty" write |
169 | buffer: If the write reaches this size or gets even samller it is |
169 | buffer: If the write reaches this size or gets even samller it is |
170 | considered empty. |
170 | considered empty. |
|
|
171 | |
|
|
172 | =item linger => <seconds> |
|
|
173 | |
|
|
174 | If non-zero (default: C<3600>), then the destructor of the |
|
|
175 | AnyEvent::Handle object will check wether there is still outstanding write |
|
|
176 | data and will install a watcher that will write out this data. No errors |
|
|
177 | will be reported (this mostly matches how the operating system treats |
|
|
178 | outstanding data at socket close time). |
|
|
179 | |
|
|
180 | This will not work for partial TLS data that could not yet been |
|
|
181 | encoded. 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 | |
174 | When this parameter is given, it enables TLS (SSL) mode, that means it |
185 | When this parameter is given, it enables TLS (SSL) mode, that means it |
175 | will start making tls handshake and will transparently encrypt/decrypt |
186 | will start making tls handshake and will transparently encrypt/decrypt |
… | |
… | |
1253 | |
1264 | |
1254 | sub DESTROY { |
1265 | sub 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 | |
1262 | This function creates and returns the Net::SSLeay::CTX object used by |
1295 | This function creates and returns the Net::SSLeay::CTX object used by |