Mercurial > hg > nginx-tests
comparison stream_upstream_least_conn.t @ 565:ff49e1c00b35
Tests: in stream tests, try to read all the data where appropriate.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 29 Apr 2015 14:58:27 +0300 |
parents | 05cbe9e2def8 |
children | 4296379213c8 |
comparison
equal
deleted
inserted
replaced
564:a1c93746570d | 565:ff49e1c00b35 |
---|---|
107 sub stream_get { | 107 sub stream_get { |
108 my ($data, $peer) = @_; | 108 my ($data, $peer) = @_; |
109 | 109 |
110 my $s = stream_connect($peer); | 110 my $s = stream_connect($peer); |
111 stream_write($s, $data); | 111 stream_write($s, $data); |
112 my $r = stream_read($s); | 112 |
113 | 113 $data = ''; |
114 $s->close; | 114 while (my $buf = stream_read($s)) { |
115 return $r; | 115 $data .= $buf; |
116 } | |
117 return $data; | |
116 } | 118 } |
117 | 119 |
118 sub stream_connect { | 120 sub stream_connect { |
119 my $peer = shift; | 121 my $peer = shift; |
120 my $s = IO::Socket::INET->new( | 122 my $s = IO::Socket::INET->new( |