# HG changeset patch # User Sergey Kandaurov # Date 1450099148 -10800 # Node ID b8db75ef1f0041c664d4681d5d3ac1ec65545ac6 # Parent 6b2512f859a0884737ed442de857f700efb1bddd Tests: stream_upstream_least_conn.t cleanup. No functional changes. diff -r 6b2512f859a0 -r b8db75ef1f00 stream_upstream_least_conn.t --- a/stream_upstream_least_conn.t Wed Dec 09 19:16:25 2015 +0300 +++ b/stream_upstream_least_conn.t Mon Dec 14 16:19:08 2015 +0300 @@ -89,31 +89,6 @@ return join ', ', map { $_ . ": " . $ports{$_} } sort keys %ports; } -sub parallel { - my ($data, $count, %opts) = @_; - my (@sockets, %ports, $peer); - - $peer = $opts{peer} || undef; - - for (1 .. $count) { - my $s = stream_connect($peer); - push @sockets, $s; - stream_write($s, $data); - select undef, undef, undef, 0.2; - } - - for (1 .. $count) { - my $s = pop @sockets; - if (stream_read($s) =~ /(\d+)/) { - $ports{$1} = 0 unless defined $ports{$1}; - $ports{$1}++; - } - close $s; - } - - return join ', ', map { $_ . ": " . $ports{$_} } sort keys %ports; -} - sub stream_get { my ($data, $peer) = @_;