-
-
Save anonymous/cd6dbf0984969cda9559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojo/UserAgent.pm b/lib/Mojo/UserAgent.pm | |
index 8712e3f..cc2b92b 100644 | |
--- a/lib/Mojo/UserAgent.pm | |
+++ b/lib/Mojo/UserAgent.pm | |
@@ -293,10 +293,13 @@ sub _remove { | |
my ($self, $id, $close) = @_; | |
# Close connection | |
- my $c = delete $self->{connections}{$id} || {}; | |
- my $tx = $c->{tx}; | |
- return map { $self->_dequeue($_, $id); $self->_loop($_)->remove($id) } 1, 0 | |
- if $close || !$tx || !$tx->keep_alive || $tx->error; | |
+ my $c = $self->{connections}{$id} || {}; | |
+ my $tx = delete $c->{tx}; | |
+ if ($close || !$tx || !$tx->keep_alive || $tx->error) { | |
+ delete $self->{connections}{$id}; | |
+ $self->_dequeue($c->{nb}, $id); | |
+ return $self->_loop($c->{nb})->remove($id); | |
+ } | |
# Keep connection alive (CONNECT requests get upgraded) | |
$self->_enqueue($c->{nb}, join(':', $self->transactor->endpoint($tx)), $id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment