Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 6, 2013
1 parent 70acb04 commit 0d3540e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -134,10 +134,9 @@ sub _cache {
for my $cached (@$old) {

# Search for id/name and remove corrupted connections
if (!$found && ($cached->[1] eq $name || $cached->[0] eq $name)) {
my $stream = $loop->stream($cached->[1]);
if ($stream && !$stream->is_readable) { $found = $cached->[1] }
else { $loop->remove($cached->[1]) }
if (!$found && first { $_ eq $name } @$cached) {
next unless my $stream = $loop->stream($cached->[1]);
$stream->is_readable ? $stream->close : ($found = $cached->[1]);
}

# Requeue
Expand Down

0 comments on commit 0d3540e

Please sign in to comment.