Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved resilience of Mojo::IOLoop::Client slightly
  • Loading branch information
kraih committed Feb 17, 2012
1 parent 573816f commit f249868
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.50 2012-02-17 00:00:00
- Improved Mojo::IOLoop to be controllable from foreign event loops.
- Improved resilience of Mojo::IOLoop::Client.
- Improved documentation.
- Fixed small bug in makefile command.

Expand Down
4 changes: 3 additions & 1 deletion lib/Mojo/IOLoop/Client.pm
Expand Up @@ -32,12 +32,14 @@ sub connect {
$args->{address} ||= '127.0.0.1';
$args->{address} = '127.0.0.1' if $args->{address} eq 'localhost';
weaken $self;
$self->iowatcher->timer(0 => sub { $self->_connect($args) });
$self->{delay} =
$self->iowatcher->timer(0 => sub { $self->_connect($args) });
}

sub _cleanup {
my $self = shift;
return unless my $watcher = $self->{iowatcher};
$watcher->drop(delete $self->{delay}) if $self->{delay};
$watcher->drop(delete $self->{timer}) if $self->{timer};
$watcher->drop(delete $self->{handle}) if $self->{handle};
}
Expand Down

0 comments on commit f249868

Please sign in to comment.