Mercurial > hg > nginx-tests
comparison stream_udp_upstream_least_conn.t @ 1235:3fc6817cd84a
Tests: explicit peer port in stream tests now required.
Notably, this eliminates extra port acquire for the default
port number in cases when it was not actually used.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Thu, 26 Oct 2017 16:36:13 +0300 |
parents | 196d33c2bb45 |
children | e4974af3fb12 |
comparison
equal
deleted
inserted
replaced
1234:0defcc1c87ab | 1235:3fc6817cd84a |
---|---|
64 | 64 |
65 is(many(10), "$port1: 5, $port2: 5", 'balanced'); | 65 is(many(10), "$port1: 5, $port2: 5", 'balanced'); |
66 | 66 |
67 my @sockets; | 67 my @sockets; |
68 for (1 .. 2) { | 68 for (1 .. 2) { |
69 my $s = dgram(); | 69 my $s = dgram('127.0.0.1:' . port(8080)); |
70 $s->write('w'); | 70 $s->write('w'); |
71 push @sockets, $s; | 71 push @sockets, $s; |
72 } | 72 } |
73 | 73 |
74 select undef, undef, undef, 0.2; | 74 select undef, undef, undef, 0.2; |
80 sub many { | 80 sub many { |
81 my ($count) = @_; | 81 my ($count) = @_; |
82 my (%ports); | 82 my (%ports); |
83 | 83 |
84 for (1 .. $count) { | 84 for (1 .. $count) { |
85 if (dgram()->io('.') =~ /(\d+)/) { | 85 if (dgram('127.0.0.1:' . port(8080))->io('.') =~ /(\d+)/) { |
86 $ports{$1} = 0 unless defined $ports{$1}; | 86 $ports{$1} = 0 unless defined $ports{$1}; |
87 $ports{$1}++; | 87 $ports{$1}++; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |