Skip to content

Commit 917f3ff

Browse files
authored
Merge pull request #419 from v0idpwn/tls-patch
Pass nodelay as a TCP option instead of a TLS option
2 parents 75cf9a7 + fe57cbf commit 917f3ff

File tree

1 file changed

+9
-4
lines changed
  • lib/grpc/client/adapters

1 file changed

+9
-4
lines changed

lib/grpc/client/adapters/gun.ex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule GRPC.Client.Adapters.Gun do
77

88
@behaviour GRPC.Client.Adapter
99

10-
@default_transport_opts [nodelay: true]
10+
@default_tcp_opts [nodelay: true]
1111
@max_retries 100
1212

1313
@impl true
@@ -24,12 +24,17 @@ defmodule GRPC.Client.Adapters.Gun do
2424
defp connect_securely(%{cred: %{ssl: ssl}} = channel, opts) do
2525
transport_opts = Map.get(opts, :transport_opts) || []
2626

27-
tls_opts = Keyword.merge(@default_transport_opts ++ ssl, transport_opts)
27+
tls_opts = Keyword.merge(ssl, transport_opts)
2828

2929
open_opts =
3030
opts
3131
|> Map.delete(:transport_opts)
32-
|> Map.merge(%{transport: :ssl, protocols: [:http2], tls_opts: tls_opts})
32+
|> Map.merge(%{
33+
transport: :ssl,
34+
protocols: [:http2],
35+
tcp_opts: @default_tcp_opts,
36+
tls_opts: tls_opts
37+
})
3338

3439
do_connect(channel, open_opts)
3540
end
@@ -45,7 +50,7 @@ defmodule GRPC.Client.Adapters.Gun do
4550

4651
transport_opts = Map.get(opts, :transport_opts) || []
4752

48-
tcp_opts = Keyword.merge(@default_transport_opts, transport_opts)
53+
tcp_opts = Keyword.merge(@default_tcp_opts, transport_opts)
4954

5055
open_opts =
5156
opts

0 commit comments

Comments
 (0)