… | |
… | |
3 | AnyEvent::MP::Base - basis for AnyEvent::MP and Coro::MP |
3 | AnyEvent::MP::Base - basis for AnyEvent::MP and Coro::MP |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | # use AnyEvent::MP or Coro::MP instead |
7 | # use AnyEvent::MP or Coro::MP instead |
|
|
8 | |
|
|
9 | =head1 DESCRIPTION |
|
|
10 | |
|
|
11 | This module provides most of the basic functionality of AnyEvent::MP, |
|
|
12 | exposed through higher level interfaces such as L<AnyEvent::MP> and |
|
|
13 | L<Coro::MP>. |
8 | |
14 | |
9 | =cut |
15 | =cut |
10 | |
16 | |
11 | package AnyEvent::MP::Base; |
17 | package AnyEvent::MP::Base; |
12 | |
18 | |
… | |
… | |
26 | |
32 | |
27 | our $DEFAULT_SECRET; |
33 | our $DEFAULT_SECRET; |
28 | |
34 | |
29 | our $CONNECT_INTERVAL = 5; # new connect every 5s, at least |
35 | our $CONNECT_INTERVAL = 5; # new connect every 5s, at least |
30 | our $CONNECT_TIMEOUT = 30; # includes handshake |
36 | our $CONNECT_TIMEOUT = 30; # includes handshake |
|
|
37 | |
|
|
38 | our $WARN = sub { |
|
|
39 | warn "$_[0]\n"; |
|
|
40 | }; |
31 | |
41 | |
32 | sub nonce($) { |
42 | sub nonce($) { |
33 | my $nonce; |
43 | my $nonce; |
34 | |
44 | |
35 | if (open my $fh, "</dev/urandom") { |
45 | if (open my $fh, "</dev/urandom") { |