"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/maxconns.t" between
memcached-1.6.8.tar.gz and memcached-1.6.9.tar.gz

About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

maxconns.t  (memcached-1.6.8):maxconns.t  (memcached-1.6.9)
#!/usr/bin/perl #!/usr/bin/perl
# NOTE: This test never worked. Memcached would ignore maxconns requests lower
# than the current ulimit. Test needs to be updated.
use strict; use strict;
use warnings; use warnings;
use Test::More; use Test::More;
use FindBin qw($Bin); use FindBin qw($Bin);
use lib "$Bin/lib"; use lib "$Bin/lib";
use MemcachedTest; use MemcachedTest;
plan skip_all => "maxconns test does not work"; my $server = new_memcached();
exit 0;
plan tests => 6;
# start up a server with 10 maximum connections my $stat_sock = $server->sock;
my $server = new_memcached('-c 100'); my @sockets = ();
my $sock = $server->sock; my $num_sockets;
my @sockets; my $rejected_conns = 0;
my $stats;
ok(defined($sock), 'Connection 0'); for (1 .. 1024) {
push (@sockets, $sock); my $sock = $server->new_sock;
if (defined($sock)) {
push(@sockets, $sock);
$stats = mem_stats($stat_sock);
if ($stats->{rejected_connections} > $rejected_conns) {
$rejected_conns = $stats->{rejected_connections};
my $buffer = "";
my $length = 31;
my $res = recv($sock, $buffer, $length, 0);
if (not $buffer eq '') {
is($buffer, "ERROR Too many open connections", "Got expected response
from the server");
}
}
}
}
foreach my $conn (1..10) { for my $s (@sockets) {
$sock = $server->new_sock; $s->close();
ok(defined($sock), "Made connection $conn");
push(@sockets, $sock);
} }
cmp_ok($stats->{rejected_connections}, '>', '1', 'rejected connections recorded'
);
$server->stop;
$stat_sock->close();
done_testing();
 End of changes. 6 change blocks. 
18 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)