summaryrefslogtreecommitdiff
path: root/t/binary.t
diff options
context:
space:
mode:
Diffstat (limited to 't/binary.t')
-rwxr-xr-xt/binary.t10
1 files changed, 7 insertions, 3 deletions
diff --git a/t/binary.t b/t/binary.t
index adc30c0..504ddef 100755
--- a/t/binary.t
+++ b/t/binary.t
@@ -573,11 +573,15 @@ sub _handle_single_response {
my $self = shift;
my $myopaque = shift;
- $self->{socket}->recv(my $response, ::MIN_RECV_BYTES);
- Test::More::is(length($response), ::MIN_RECV_BYTES, "Expected read length");
+ my $hdr = "";
+ while(::MIN_RECV_BYTES - length($hdr) > 0) {
+ $self->{socket}->recv(my $response, ::MIN_RECV_BYTES - length($hdr));
+ $hdr .= $response;
+ }
+ Test::More::is(length($hdr), ::MIN_RECV_BYTES, "Expected read length");
my ($magic, $cmd, $keylen, $extralen, $datatype, $status, $remaining,
- $opaque, $ident_hi, $ident_lo) = unpack(::RES_PKT_FMT, $response);
+ $opaque, $ident_hi, $ident_lo) = unpack(::RES_PKT_FMT, $hdr);
Test::More::is($magic, ::RES_MAGIC, "Got proper response magic");
my $cas = ($ident_hi * 2 ** 32) + $ident_lo;