Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed memory leak in Mojo::IOLoop::Client
  • Loading branch information
kraih committed Aug 2, 2014
1 parent 363eeb8 commit 0101346
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

5.24 2014-08-02
- Improved url_escape performance slightly.
- Fixed memory leak in Mojo::IOLoop::Client.
- Fixed bug where ojo would sometimes die silently.

5.23 2014-07-31
Expand Down
1 change: 1 addition & 0 deletions lib/Mojo/IOLoop/Client.pm
Expand Up @@ -136,6 +136,7 @@ sub _try_socks {
$reactor->remove($handle);
return $self->emit(error => 'SOCKS upgrade failed')
unless IO::Socket::Socks->start_SOCKS($handle, %options);
weaken $self;
$reactor->io($handle => sub { $self->_socks($args) })->watch($handle, 0, 1);
}

Expand Down
7 changes: 2 additions & 5 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -304,11 +304,8 @@ sub _remove {
# Close connection
my $c = delete $self->{connections}{$id} || {};
my $tx = $c->{tx};
if ($close || !$tx || !$tx->keep_alive || $tx->error) {
$self->_dequeue($_, $id) for 1, 0;
$self->_loop($_)->remove($id) for 1, 0;
return;
}
return map { $self->_dequeue($_, $id); $self->_loop($_)->remove($id) } 1, 0
if $close || !$tx || !$tx->keep_alive || $tx->error;

# Keep connection alive (CONNECT requests get upgraded)
$self->_enqueue($c->{nb}, join(':', $self->transactor->endpoint($tx)), $id)
Expand Down

0 comments on commit 0101346

Please sign in to comment.