Changeset 764
- Timestamp:
- 03/25/08 08:25:15 (20 months ago)
- Files:
-
- 1 modified
-
branches/binary/server/t/binary.t (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/binary/server/t/binary.t
r682 r764 15 15 use constant CMD_DELETE => 4; 16 16 use constant CMD_INCR => 5; 17 use constant CMD_QUIT => 6; 18 use constant CMD_FLUSH => 7; 19 use constant CMD_GETQ => 8; 20 use constant CMD_NOOP => 9; 21 use constant CMD_VERSION => 10; 17 use constant CMD_DECR => 6; 18 use constant CMD_QUIT => 7; 19 use constant CMD_FLUSH => 8; 20 use constant CMD_GETQ => 9; 21 use constant CMD_NOOP => 10; 22 use constant CMD_VERSION => 11; 22 23 23 24 use constant CMD_GETS => 50; … … 36 37 use constant INCRDECR_PKT_FMT => "NNNNN"; 37 38 38 use constant REQ_MAGIC_BYTE => 0x 0f;39 use constant RES_MAGIC_BYTE => 0x f0;40 41 use constant PKT_FMT => "CC CxNN";39 use constant REQ_MAGIC_BYTE => 0x80; 40 use constant RES_MAGIC_BYTE => 0x80; 41 42 use constant PKT_FMT => "CCSCxxxNN"; 42 43 43 44 #min recv packet size … … 71 72 }; 72 73 74 diag "Flushing..."; 73 75 $mc->flush; 74 76 … … 76 78 diag "Test Version"; 77 79 my $v = $mc->version; 78 ok(defined $v && length($v), "Proper version ");80 ok(defined $v && length($v), "Proper version: $v"); 79 81 } 80 82 … … 243 245 244 246 my $host = shift || '127.0.0.1'; 245 my $port = shift || 1121 2;247 my $port = shift || 11211; 246 248 247 249 my $sock = IO::Socket::INET->new(PeerHost => $host, PeerPort => $port); … … 275 277 my $extralen = length($extraHeader); 276 278 277 my $msg = pack(::PKT_FMT, ::REQ_MAGIC_BYTE, $cmd, $keylen, $opaque, $keylen + $vallen + $extralen); 279 my $msg = pack(::PKT_FMT, ::REQ_MAGIC_BYTE, $cmd, $keylen, $extralen, 280 $keylen + $vallen + $extralen, $opaque); 278 281 return $self->{socket}->send($msg . $extraHeader . $key . $val); 279 282 } … … 287 290 Test::More::is(length($response), ::MIN_RECV_PACKET, "Expected read length"); 288 291 289 my ($magic, $cmd, $errcode, $opaque, $remaining) = unpack(::PKT_FMT, $response); 292 my ($magic, $cmd, $errcode, $extralen, $remaining, 293 $opaque) = unpack(::PKT_FMT, $response); 290 294 291 295 Test::More::is($magic, ::RES_MAGIC_BYTE, "Got proper magic");
