Skip to content

Commit

Permalink
Merge pull request #129 from japhb/tcp-nodelay
Browse files Browse the repository at this point in the history
Turn on TCP_NODELAY for HTTP Client and Server
  • Loading branch information
jnthn authored Mar 12, 2021
2 parents 7751b2a + 4697bef commit 9fd6382
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cro/HTTP/Client.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 2 additions & 0 deletions lib/Cro/HTTP/Server.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 9fd6382

Please sign in to comment.