aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/manual/gun.asciidoc4
-rw-r--r--src/gun.erl5
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/src/manual/gun.asciidoc b/doc/src/manual/gun.asciidoc
index d130d62..9ad3e8e 100644
--- a/doc/src/manual/gun.asciidoc
+++ b/doc/src/manual/gun.asciidoc
@@ -354,9 +354,11 @@ supervise (true)::
Whether the Gun process should be started under the `gun_sup`
supervisor. Set to `false` to use your own supervisor.
-tcp_opts ([])::
+tcp_opts (DefaultOpts)::
TCP options used when establishing the connection.
+By default Gun enables send timeouts with the options
+`[{send_timeout, 15000}, {send_timeout_close, true}]`.
tls_handshake_timeout (infinity)::
diff --git a/src/gun.erl b/src/gun.erl
index bd19b7c..880a2ae 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -1022,7 +1022,10 @@ default_retry_fun(Retries, Opts) ->
domain_lookup(_, {retries, Retries, _}, State=#state{host=Host, port=Port, opts=Opts,
event_handler=EvHandler, event_handler_state=EvHandlerState0}) ->
- TransOpts = maps:get(tcp_opts, Opts, []),
+ TransOpts = maps:get(tcp_opts, Opts, [
+ {send_timeout, 15000},
+ {send_timeout_close, true}
+ ]),
DomainLookupTimeout = maps:get(domain_lookup_timeout, Opts, infinity),
DomainLookupEvent = #{
host => Host,