Skip to content

Commit

Permalink
acceptors are not important anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 16, 2015
1 parent 15ba0ad commit a8623de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

5.80 2015-02-16
5.80 2015-02-17
- Deprecated Mojo::IOLoop::max_connections in favor of
Mojo::IOLoop::concurrency.
- Removed accept_interval, lock and unlock attributes from Mojo::IOLoop.
Expand Down
17 changes: 8 additions & 9 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -77,7 +77,7 @@ sub concurrency {
my $self = _instance(shift);
return $self->{concurrency} //= 1000 unless @_;
my $concurrency = $self->{concurrency} = shift;
$self->{stop} ||= $self->recurring(1 => \&_stop) if $concurrency == 0;
$self->{stop} ||= $self->recurring(1 => \&_graceful) if $concurrency == 0;
return $self;
}

Expand Down Expand Up @@ -166,6 +166,13 @@ sub stream {

sub timer { shift->_timer(timer => @_) }

sub _graceful {
my $self = shift;
return if keys %{$self->{connections}};
$self->_remove(delete $self->{stop});
$self->stop;
}

sub _id {
my $self = shift;
my $id;
Expand Down Expand Up @@ -213,14 +220,6 @@ sub _remove {
$self->_maybe_accepting;
}

sub _stop {
my $self = shift;
return if keys %{$self->{connections}};
$self->stop if $self->concurrency == 0;
return if keys %{$self->{acceptors}};
$self->_remove(delete $self->{stop}) if $self->{stop};
}

sub _stream {
my ($self, $stream, $id) = @_;

Expand Down

0 comments on commit a8623de

Please sign in to comment.