tokuhirom
10/17/2015 - 1:55 PM

This script stuck with `ab -c 10 -n 1000 http://127.0.0.1:15555/`

This script stuck with ab -c 10 -n 1000 http://127.0.0.1:15555/

use v6;

my $port = 15555;
my $host = '127.0.0.1';

say "$host:$port";

react {
    whenever IO::Socket::Async.listen($host, $port) -> $conn {
        my $chan = $conn.chars-supply.Channel;
        $chan.receive.perl.say;
        await $conn.write("HTTP/1.0 200 OK\r\n\r\n".encode);
        $conn.close;
    }
}