… | |
… | |
129 | |
129 | |
130 | The actual numeric host and port (the socket peername) are passed as |
130 | The actual numeric host and port (the socket peername) are passed as |
131 | parameters, together with a retry callback. |
131 | parameters, together with a retry callback. |
132 | |
132 | |
133 | When, for some reason, the handle is not acceptable, then calling |
133 | When, for some reason, the handle is not acceptable, then calling |
134 | C<$retry> will continue with the next conenction target (in case of |
134 | C<$retry> will continue with the next connection target (in case of |
135 | multi-homed hosts or SRV records there can be multiple connection |
135 | multi-homed hosts or SRV records there can be multiple connection |
136 | endpoints). When it is called then the read and write queues, eof status, |
136 | endpoints). At the time it is called the read and write queues, eof |
137 | tls status and similar properties of the handle are being reset. |
137 | status, tls status and similar properties of the handle will have been |
|
|
138 | reset. |
138 | |
139 | |
139 | In most cases, ignoring the C<$retry> parameter is the way to go. |
140 | In most cases, ignoring the C<$retry> parameter is the way to go. |
140 | |
141 | |
141 | =item on_connect_error => $cb->($handle, $message) |
142 | =item on_connect_error => $cb->($handle, $message) |
142 | |
143 | |
143 | This callback is called when the conenction could not be |
144 | This callback is called when the connection could not be |
144 | established. C<$!> will contain the relevant error code, and C<$message> a |
145 | established. C<$!> will contain the relevant error code, and C<$message> a |
145 | message describing it (usually the same as C<"$!">). |
146 | message describing it (usually the same as C<"$!">). |
146 | |
147 | |
147 | If this callback isn't specified, then C<on_error> will be called with a |
148 | If this callback isn't specified, then C<on_error> will be called with a |
148 | fatal error instead. |
149 | fatal error instead. |
… | |
… | |
304 | |
305 | |
305 | =item keepalive => <boolean> |
306 | =item keepalive => <boolean> |
306 | |
307 | |
307 | Enables (default disable) the SO_KEEPALIVE option on the stream socket: |
308 | Enables (default disable) the SO_KEEPALIVE option on the stream socket: |
308 | normally, TCP connections have no time-out once established, so TCP |
309 | normally, TCP connections have no time-out once established, so TCP |
309 | conenctions, once established, can stay alive forever even when the other |
310 | connections, once established, can stay alive forever even when the other |
310 | side has long gone. TCP keepalives are a cheap way to take down long-lived |
311 | side has long gone. TCP keepalives are a cheap way to take down long-lived |
311 | TCP connections whent he other side becomes unreachable. While the default |
312 | TCP connections whent he other side becomes unreachable. While the default |
312 | is OS-dependent, TCP keepalives usually kick in after around two hours, |
313 | is OS-dependent, TCP keepalives usually kick in after around two hours, |
313 | and, if the other side doesn't reply, take down the TCP connection some 10 |
314 | and, if the other side doesn't reply, take down the TCP connection some 10 |
314 | to 15 minutes later. |
315 | to 15 minutes later. |
… | |
… | |
374 | C<undef>. |
375 | C<undef>. |
375 | |
376 | |
376 | =item tls => "accept" | "connect" | Net::SSLeay::SSL object |
377 | =item tls => "accept" | "connect" | Net::SSLeay::SSL object |
377 | |
378 | |
378 | When this parameter is given, it enables TLS (SSL) mode, that means |
379 | When this parameter is given, it enables TLS (SSL) mode, that means |
379 | AnyEvent will start a TLS handshake as soon as the conenction has been |
380 | AnyEvent will start a TLS handshake as soon as the connection has been |
380 | established and will transparently encrypt/decrypt data afterwards. |
381 | established and will transparently encrypt/decrypt data afterwards. |
381 | |
382 | |
382 | All TLS protocol errors will be signalled as C<EPROTO>, with an |
383 | All TLS protocol errors will be signalled as C<EPROTO>, with an |
383 | appropriate error message. |
384 | appropriate error message. |
384 | |
385 | |