… | |
… | |
42 | my @pool; |
42 | my @pool; |
43 | |
43 | |
44 | # one "execution thread" |
44 | # one "execution thread" |
45 | sub handler { |
45 | sub handler { |
46 | while () { |
46 | while () { |
47 | my $new = pop @newcons; |
|
|
48 | if ($new) { |
47 | if (@newcons) { |
49 | eval { |
48 | eval { |
50 | conn->new(@$new)->handle; |
49 | conn->new(@{pop @newcons})->handle; |
51 | }; |
50 | }; |
52 | slog 1, "$@" if $@ && !ref $@; |
51 | slog 1, "$@" if $@ && !ref $@; |
53 | $connections->up; |
52 | $connections->up; |
54 | } else { |
53 | } else { |
55 | last if @pool >= $MAX_POOL; |
54 | last if @pool >= $MAX_POOL; |