… | |
… | |
50 | } |
50 | } |
51 | |
51 | |
52 | our $connections = new Coro::Semaphore $MAX_CONNECTS || 250; |
52 | our $connections = new Coro::Semaphore $MAX_CONNECTS || 250; |
53 | our $httpevent = new Coro::Signal; |
53 | our $httpevent = new Coro::Signal; |
54 | |
54 | |
55 | our $queue_file = new transferqueue $MAX_TRANSFERS; |
55 | our $queue_file = new transferqueue slots => $MAX_TRANSFERS, maxsize => 256*1024*1024; |
56 | our $queue_index = new transferqueue 10; |
56 | our $queue_index = new transferqueue slots => 10; |
57 | |
57 | |
58 | my @newcons; |
58 | my @newcons; |
59 | my @pool; |
59 | my @pool; |
60 | |
60 | |
61 | # one "execution thread" |
61 | # one "execution thread" |
… | |
… | |
161 | my (undef, $iaddr) = unpack_sockaddr_in $peername |
161 | my (undef, $iaddr) = unpack_sockaddr_in $peername |
162 | or $self->err(500, "unable to decode peername"); |
162 | or $self->err(500, "unable to decode peername"); |
163 | |
163 | |
164 | $self->{remote_addr} = |
164 | $self->{remote_addr} = |
165 | $self->{remote_id} = inet_ntoa $iaddr; |
165 | $self->{remote_id} = inet_ntoa $iaddr; |
|
|
166 | |
166 | $self->{time} = $::NOW; |
167 | $self->{time} = $::NOW; |
167 | |
168 | |
168 | weaken ($Coro::current->{conn} = $self); |
169 | weaken ($Coro::current->{conn} = $self); |
169 | |
170 | |
170 | $::conns++; |
171 | $::conns++; |
… | |
… | |
566 | } |
567 | } |
567 | } |
568 | } |
568 | |
569 | |
569 | if ($blocked{$self->{remote_id}}) { |
570 | if ($blocked{$self->{remote_id}}) { |
570 | $self->{h}{connection} = "close"; |
571 | $self->{h}{connection} = "close"; |
571 | die bless {}, err:: |
572 | die bless {}, err::; |
572 | } |
573 | } |
573 | |
574 | |
574 | if (0) { # !AIO |
575 | if (0) { # !AIO |
575 | sysread $fh, $buf, $h > $bufsize ? $bufsize : $h |
576 | sysread $fh, $buf, $h > $bufsize ? $bufsize : $h |
576 | or last; |
577 | or last; |