From 4697befccdd4fe8e991f7d83251dc522bdc0405b Mon Sep 17 00:00:00 2001 From: Geoffrey Broadwell Date: Sun, 7 Mar 2021 14:15:57 -0800 Subject: [PATCH] Turn on TCP_NODELAY for HTTP Client and Server --- lib/Cro/HTTP/Client.pm6 | 4 ++-- lib/Cro/HTTP/Server.pm6 | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cro/HTTP/Client.pm6 b/lib/Cro/HTTP/Client.pm6 index 3485d14f..5f3dd225 100644 --- a/lib/Cro/HTTP/Client.pm6 +++ b/lib/Cro/HTTP/Client.pm6 @@ -666,10 +666,10 @@ class Cro::HTTP::Client { my $in = Supplier::Preserving.new; my %ca = self ?? (self.ca // $ca // {}) !! $ca // {}; my $out = $version-decision - ?? establish($connector, $in.Supply, $log-connection, :$host, :$port, |{%tls-config, %ca}) + ?? establish($connector, $in.Supply, $log-connection, :nodelay, :$host, :$port, |{%tls-config, %ca}) !! do { my $s = Supplier::Preserving.new; - establish($connector, $in.Supply, $log-connection, :$host, :$port, |{%tls-config, %ca}).tap: + establish($connector, $in.Supply, $log-connection, :nodelay, :$host, :$port, |{%tls-config, %ca}).tap: { $s.emit($_) }, done => { $s.done }, quit => { diff --git a/lib/Cro/HTTP/Server.pm6 b/lib/Cro/HTTP/Server.pm6 index 29c9f933..18f2ea0b 100644 --- a/lib/Cro/HTTP/Server.pm6 +++ b/lib/Cro/HTTP/Server.pm6 @@ -139,6 +139,7 @@ class Cro::HTTP::Server does Cro::Service { return pack2(:!http2-only); } elsif $http-val eqv <1.1>|() { my $listener = Cro::TLS::Listener.new( + :nodelay, |(:$host with $host), |(:$port with $port), |%tls); @@ -150,6 +151,7 @@ class Cro::HTTP::Server does Cro::Service { else { if so $http-val == <1.1>|() { my $listener = Cro::TCP::Listener.new( + :nodelay, |(:$host with $host), |(:$port with $port)); return pack1($listener);